@modern-js/main-doc 2.21.1 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +18 -0
- package/docs/en/apis/app/commands.mdx +5 -5
- package/docs/en/apis/app/hooks/api/api.mdx +80 -0
- package/docs/en/apis/app/hooks/api/app.mdx +12 -0
- package/docs/en/apis/app/hooks/api/lambda.mdx +57 -0
- package/docs/en/apis/app/hooks/api/test.mdx +1 -1
- package/docs/en/apis/app/hooks/config/html.mdx +2 -2
- package/docs/en/apis/app/hooks/config/icon.mdx +19 -19
- package/docs/en/apis/app/hooks/config/mock.mdx +1 -1
- package/docs/en/apis/app/hooks/config/public.mdx +10 -10
- package/docs/en/apis/app/hooks/config/storybook.mdx +3 -3
- package/docs/en/apis/app/hooks/config/upload.mdx +13 -13
- package/docs/en/apis/app/hooks/modern-config.mdx +4 -4
- package/docs/en/apis/app/hooks/server/index_.mdx +2 -9
- package/docs/en/apis/app/hooks/server/test.mdx +5 -2
- package/docs/en/apis/app/hooks/shared.mdx +1 -1
- package/docs/en/apis/app/hooks/src/app.mdx +17 -27
- package/docs/en/apis/app/hooks/src/index_.mdx +6 -6
- package/docs/en/apis/app/hooks/src/pages.mdx +41 -37
- package/docs/en/apis/app/hooks/src/routes.mdx +16 -36
- package/docs/en/apis/app/hooks/src/server.mdx +1 -1
- package/docs/en/apis/app/hooks/src/stories.mdx +6 -3
- package/docs/en/apis/app/hooks/src/test.mdx +4 -3
- package/docs/en/apis/app/runtime/core/use-runtime-context.mdx +5 -1
- package/docs/en/apis/app/runtime/web-server/hook.mdx +2 -2
- package/docs/en/apis/app/runtime/web-server/middleware.mdx +2 -2
- package/docs/en/components/init-app.mdx +3 -3
- package/docs/en/components/init-rspack-app.mdx +4 -4
- package/docs/en/components/language-config.mdx +9 -0
- package/docs/en/components/package-manager.mdx +11 -0
- package/docs/en/components/ua-polyfill.mdx +2 -2
- package/docs/en/configure/app/source/config-dir.mdx +1 -1
- package/docs/en/configure/app/source/design-system.mdx +67 -67
- package/docs/en/configure/app/source/disable-default-entries.mdx +6 -5
- package/docs/en/configure/app/source/disable-entry-dirs.mdx +5 -5
- package/docs/en/configure/app/source/enable-async-entry.mdx +9 -9
- package/docs/en/configure/app/source/entries-dir.mdx +3 -3
- package/docs/en/configure/app/source/entries.mdx +21 -19
- package/docs/en/configure/app/tools/swc.mdx +2 -2
- package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -2
- package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
- package/docs/en/guides/advanced-features/bff/type.mdx +5 -5
- package/docs/en/guides/advanced-features/rspack-start.mdx +6 -6
- package/docs/en/guides/advanced-features/ssg.mdx +2 -2
- package/docs/en/guides/advanced-features/testing.mdx +2 -2
- package/docs/en/guides/advanced-features/web-server.mdx +2 -2
- package/docs/en/guides/basic-features/css.mdx +2 -2
- package/docs/en/guides/basic-features/mock.mdx +1 -1
- package/docs/en/guides/basic-features/routes.mdx +11 -7
- package/docs/en/guides/concept/entries.mdx +3 -3
- package/docs/en/guides/topic-detail/generator/create/_category_.json +4 -0
- package/docs/en/guides/topic-detail/generator/create/config.mdx +75 -0
- package/docs/en/guides/topic-detail/generator/create/option.md +151 -0
- package/docs/en/guides/topic-detail/generator/create/use.mdx +66 -0
- package/docs/en/guides/topic-detail/generator/new/_category_.json +4 -0
- package/docs/en/guides/topic-detail/generator/new/config.md +155 -0
- package/docs/en/guides/topic-detail/generator/new/option.md +67 -0
- package/docs/en/guides/topic-detail/generator/new/use.md +95 -0
- package/docs/en/guides/topic-detail/generator/plugin/_category_.json +2 -2
- package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
- package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +49 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/context.md +184 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/input.md +124 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
- package/docs/en/guides/topic-detail/generator/plugin/category.md +88 -0
- package/docs/en/guides/topic-detail/generator/plugin/context.md +104 -0
- package/docs/en/guides/topic-detail/generator/plugin/structure.md +106 -0
- package/docs/en/guides/topic-detail/generator/plugin/use.md +33 -0
- package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +8 -8
- package/docs/en/tutorials/first-app/c03-css.mdx +2 -2
- package/docs/en/tutorials/first-app/c08-entries.mdx +3 -3
- package/docs/zh/apis/app/commands.mdx +3 -3
- package/docs/zh/apis/app/hooks/api/{functions/api.mdx → api.mdx} +4 -4
- package/docs/zh/apis/app/hooks/api/app.mdx +12 -0
- package/docs/zh/apis/app/hooks/api/{framework/lambda.mdx → lambda.mdx} +5 -5
- package/docs/zh/apis/app/hooks/api/test.mdx +3 -3
- package/docs/zh/apis/app/hooks/config/icon.mdx +15 -15
- package/docs/zh/apis/app/hooks/config/mock.mdx +1 -1
- package/docs/zh/apis/app/hooks/config/public.mdx +3 -3
- package/docs/zh/apis/app/hooks/config/upload.mdx +1 -1
- package/docs/zh/apis/app/hooks/modern-config.mdx +3 -3
- package/docs/zh/apis/app/hooks/server/index_.mdx +1 -6
- package/docs/zh/apis/app/hooks/shared.mdx +1 -1
- package/docs/zh/apis/app/hooks/src/app.mdx +15 -25
- package/docs/zh/apis/app/hooks/src/index_.mdx +6 -6
- package/docs/zh/apis/app/hooks/src/pages.mdx +7 -3
- package/docs/zh/apis/app/hooks/src/routes.mdx +4 -4
- package/docs/zh/apis/app/hooks/src/stories.mdx +1 -1
- package/docs/zh/apis/app/runtime/core/use-runtime-context.mdx +5 -1
- package/docs/zh/components/language-config.mdx +9 -0
- package/docs/zh/components/package-manager.mdx +11 -0
- package/docs/zh/components/ua-polyfill.mdx +1 -1
- package/docs/zh/configure/app/source/design-system.mdx +3 -4
- package/docs/zh/configure/app/source/enable-async-entry.mdx +2 -5
- package/docs/zh/configure/app/source/entries.mdx +2 -2
- package/docs/zh/configure/app/tools/swc.mdx +2 -2
- package/docs/zh/guides/advanced-features/rspack-start.mdx +6 -6
- package/docs/zh/guides/advanced-features/ssg.mdx +1 -1
- package/docs/zh/guides/advanced-features/testing.mdx +2 -2
- package/docs/zh/guides/advanced-features/web-server.mdx +1 -1
- package/docs/zh/guides/basic-features/css.mdx +1 -1
- package/docs/zh/guides/basic-features/mock.mdx +1 -1
- package/docs/zh/guides/basic-features/routes.mdx +7 -4
- package/docs/zh/guides/concept/entries.mdx +3 -3
- package/docs/zh/guides/topic-detail/generator/create/_category_.json +4 -0
- package/docs/zh/guides/topic-detail/generator/create/config.mdx +76 -0
- package/docs/zh/guides/topic-detail/generator/create/option.md +151 -0
- package/docs/zh/guides/topic-detail/generator/create/use.mdx +66 -0
- package/docs/zh/guides/topic-detail/generator/new/_category_.json +4 -0
- package/docs/zh/guides/topic-detail/generator/new/config.md +153 -0
- package/docs/zh/guides/topic-detail/generator/new/option.md +67 -0
- package/docs/zh/guides/topic-detail/generator/new/use.md +94 -0
- package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +2 -2
- package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
- package/docs/zh/guides/topic-detail/generator/plugin/api/afterForged.md +50 -0
- package/docs/zh/guides/topic-detail/generator/plugin/api/context.md +184 -0
- package/docs/zh/guides/topic-detail/generator/plugin/api/input.md +124 -0
- package/docs/zh/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
- package/docs/zh/guides/topic-detail/generator/plugin/category.md +93 -0
- package/docs/zh/guides/topic-detail/generator/plugin/context.md +105 -0
- package/docs/zh/guides/topic-detail/generator/plugin/structure.md +106 -0
- package/docs/zh/guides/topic-detail/generator/plugin/use.md +33 -0
- package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +4 -4
- package/docs/zh/guides/topic-detail/model/test-model.mdx +1 -1
- package/docs/zh/tutorials/first-app/c03-css.mdx +1 -1
- package/docs/zh/tutorials/first-app/c08-entries.mdx +1 -1
- package/package.json +5 -5
- package/docs/en/apis/app/hooks/api/framework/_category_.json +0 -4
- package/docs/en/apis/app/hooks/api/framework/lambda.mdx +0 -57
- package/docs/en/apis/app/hooks/api/functions/_category_.json +0 -4
- package/docs/en/apis/app/hooks/api/functions/api.mdx +0 -81
- package/docs/en/apis/app/hooks/api/functions/app.mdx +0 -12
- package/docs/en/apis/app/hooks/api/functions/common.mdx +0 -9
- package/docs/en/guides/topic-detail/generator/codesmith/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
- package/docs/en/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
- package/docs/en/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
- package/docs/en/guides/topic-detail/generator/codesmith/api/git.mdx +0 -50
- package/docs/en/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -57
- package/docs/en/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
- package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
- package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
- package/docs/en/guides/topic-detail/generator/codesmith/introduce.mdx +0 -47
- package/docs/en/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
- package/docs/en/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
- package/docs/en/guides/topic-detail/generator/config/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/config/app.mdx +0 -82
- package/docs/en/guides/topic-detail/generator/config/common.mdx +0 -100
- package/docs/en/guides/topic-detail/generator/config/module.mdx +0 -42
- package/docs/en/guides/topic-detail/generator/config/monorepo.mdx +0 -28
- package/docs/en/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
- package/docs/en/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
- package/docs/en/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
- package/docs/en/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -58
- package/docs/en/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
- package/docs/en/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
- package/docs/en/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
- package/docs/en/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
- package/docs/en/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
- package/docs/en/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
- package/docs/en/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
- package/docs/en/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
- package/docs/en/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
- package/docs/en/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
- package/docs/en/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
- package/docs/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
- package/docs/en/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
- package/docs/en/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
- package/docs/en/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
- package/docs/en/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
- package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
- package/docs/en/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
- package/docs/en/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -31
- package/docs/en/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
- package/docs/en/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -90
- package/docs/en/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
- package/docs/en/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
- package/docs/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
- package/docs/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
- package/docs/en/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
- package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
- package/docs/en/guides/topic-detail/generator/plugin/use.mdx +0 -61
- package/docs/en/guides/topic-detail/generator/project.mdx +0 -118
- package/docs/zh/apis/app/hooks/api/framework/_category_.json +0 -4
- package/docs/zh/apis/app/hooks/api/functions/_category_.json +0 -4
- package/docs/zh/apis/app/hooks/api/functions/app.mdx +0 -12
- package/docs/zh/apis/app/hooks/api/functions/common.mdx +0 -9
- package/docs/zh/guides/topic-detail/generator/codesmith/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
- package/docs/zh/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
- package/docs/zh/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
- package/docs/zh/guides/topic-detail/generator/codesmith/api/git.mdx +0 -49
- package/docs/zh/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -56
- package/docs/zh/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
- package/docs/zh/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -47
- package/docs/zh/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
- package/docs/zh/guides/topic-detail/generator/codesmith/introduce.mdx +0 -59
- package/docs/zh/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
- package/docs/zh/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
- package/docs/zh/guides/topic-detail/generator/config/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/config/app.mdx +0 -82
- package/docs/zh/guides/topic-detail/generator/config/common.mdx +0 -100
- package/docs/zh/guides/topic-detail/generator/config/module.mdx +0 -42
- package/docs/zh/guides/topic-detail/generator/config/monorepo.mdx +0 -28
- package/docs/zh/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -55
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
- package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
- package/docs/zh/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
- package/docs/zh/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
- package/docs/zh/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
- package/docs/zh/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
- package/docs/zh/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
- package/docs/zh/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
- package/docs/zh/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
- package/docs/zh/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -57
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -56
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -29
- package/docs/zh/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
- package/docs/zh/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -92
- package/docs/zh/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
- package/docs/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
- package/docs/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
- package/docs/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
- package/docs/zh/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -16
- package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
- package/docs/zh/guides/topic-detail/generator/plugin/use.mdx +0 -61
- package/docs/zh/guides/topic-detail/generator/project.mdx +0 -118
@@ -7,8 +7,8 @@ sidebar_label: designSystem
|
|
7
7
|
- **Type:** `Object`
|
8
8
|
- **Default:** See configuration details below.
|
9
9
|
|
10
|
-
:::caution
|
11
|
-
|
10
|
+
:::caution
|
11
|
+
Tailwind CSS feature needs to be enabled first by running `pnpm run new`.
|
12
12
|
|
13
13
|
:::
|
14
14
|
|
@@ -645,22 +645,22 @@ const designSystem = {
|
|
645
645
|
};
|
646
646
|
```
|
647
647
|
|
648
|
+
</details>
|
649
|
+
|
648
650
|
:::tip
|
649
|
-
|
651
|
+
For more information on TailwindCSS configuration, please refer to [here](https://tailwindcss.com/docs/configuration#theme).
|
650
652
|
|
651
653
|
:::
|
652
654
|
|
653
|
-
|
654
|
-
|
655
|
-
`designSystem` is used to define the project's color palette, typographic scale (Typographic Scales or Type Scale), font list, breakpoints, border rounded values, and more. Because Modern.js borrowed the design method of Tailwind Theme, and also integrates Tailwind CSS internally, the `designSystem` is used in the same way as Tailwind CSS Theme.
|
655
|
+
The `designSystem` is used to define the project's color palette, typographic scales, font list, breakpoints, border radius values, and more. As Modern.js uses the design approach of Tailwind Theme and also integrates Tailwind CSS internally, the usage of `designSystem` is the same as that of Tailwind CSS Theme.
|
656
656
|
|
657
657
|
### Structure
|
658
658
|
|
659
|
-
The `designSystem` object contains properties for `screens`, `colors`,
|
659
|
+
The `designSystem` object contains properties for `screens`, `colors`, `spacing`, and each customizable core plugin.
|
660
660
|
|
661
661
|
#### Screens
|
662
662
|
|
663
|
-
Use `screens` to customize
|
663
|
+
Use `screens` to customize the responsive breakpoints in your project:
|
664
664
|
|
665
665
|
```js
|
666
666
|
const designSystem = {
|
@@ -673,9 +673,9 @@ const designSystem = {
|
|
673
673
|
};
|
674
674
|
```
|
675
675
|
|
676
|
-
|
676
|
+
The property names in the `screens` object are screen names (used as prefixes for the responsive utility variants generated by TailwindCSS, such as `md:text-center`), and the values are the `min-width` at which the breakpoint should start.
|
677
677
|
|
678
|
-
|
678
|
+
The default breakpoints are inspired by common device resolutions:
|
679
679
|
|
680
680
|
```js
|
681
681
|
const designSystem = {
|
@@ -695,7 +695,7 @@ const designSystem = {
|
|
695
695
|
};
|
696
696
|
```
|
697
697
|
|
698
|
-
You can use any
|
698
|
+
You can use any names you like as properties for your breakpoints in your project:
|
699
699
|
|
700
700
|
```js
|
701
701
|
const designSystem = {
|
@@ -712,7 +712,7 @@ const designSystem = {
|
|
712
712
|
};
|
713
713
|
```
|
714
714
|
|
715
|
-
These screen names are reflected in `utilities`, so `text-center` now
|
715
|
+
These screen names are reflected in `utilities`, so `text-center` would now look like this:
|
716
716
|
|
717
717
|
```css
|
718
718
|
.text-center {
|
@@ -738,9 +738,9 @@ These screen names are reflected in `utilities`, so `text-center` now looks like
|
|
738
738
|
}
|
739
739
|
```
|
740
740
|
|
741
|
-
##### Max-width
|
741
|
+
##### Max-width Breakpoint
|
742
742
|
|
743
|
-
If you want to use
|
743
|
+
If you want to use `max-width` breakpoints instead of `min-width`, you can specify the screen as an object with a `max` property:
|
744
744
|
|
745
745
|
```js
|
746
746
|
const designSystem = {
|
@@ -760,7 +760,7 @@ const designSystem = {
|
|
760
760
|
};
|
761
761
|
```
|
762
762
|
|
763
|
-
If necessary,
|
763
|
+
If necessary, you can create breakpoints with both `min-width` and `max-width` definitions, like so:
|
764
764
|
|
765
765
|
```js
|
766
766
|
const designSystem = {
|
@@ -773,11 +773,11 @@ const designSystem = {
|
|
773
773
|
};
|
774
774
|
```
|
775
775
|
|
776
|
-
#####
|
776
|
+
##### Breakpoints with Multiple Ranges
|
777
777
|
|
778
|
-
Sometimes it
|
778
|
+
Sometimes it can be useful to apply a single breakpoint definition to multiple ranges.
|
779
779
|
|
780
|
-
For example,
|
780
|
+
For example, suppose you have a `sidebar` and want to base the breakpoints on the width of the content area rather than the entire viewport. You can simulate this by using a smaller breakpoint style when the `sidebar` is visible and the content area is reduced:
|
781
781
|
|
782
782
|
```js
|
783
783
|
const designSystem = {
|
@@ -796,9 +796,9 @@ const designSystem = {
|
|
796
796
|
};
|
797
797
|
```
|
798
798
|
|
799
|
-
##### Custom
|
799
|
+
##### Custom Media Queries
|
800
800
|
|
801
|
-
If you need to provide
|
801
|
+
If you need to provide fully custom media queries for your breakpoints, you can use an object with a `raw` property:
|
802
802
|
|
803
803
|
```js
|
804
804
|
const designSystem = {
|
@@ -813,9 +813,9 @@ const designSystem = {
|
|
813
813
|
|
814
814
|
##### Print Style
|
815
815
|
|
816
|
-
The `raw` option
|
816
|
+
The `raw` option may be especially useful if you need to apply different styles for printing.
|
817
817
|
|
818
|
-
All you need to do is add a `print`
|
818
|
+
All you need to do is add a `print` under `designSystem.extend.screens`:
|
819
819
|
|
820
820
|
```js
|
821
821
|
const designSystem = {
|
@@ -828,7 +828,7 @@ const designSystem = {
|
|
828
828
|
};
|
829
829
|
```
|
830
830
|
|
831
|
-
|
831
|
+
Then, you can use classes like `print:text-black` to specify styles that should only be applied when someone tries to print the page:
|
832
832
|
|
833
833
|
```html
|
834
834
|
<div class="text-gray-700 print:text-black">
|
@@ -838,7 +838,7 @@ You can then use a class like `print:text-black` to specify styles that are only
|
|
838
838
|
|
839
839
|
##### Dark Mode
|
840
840
|
|
841
|
-
The `raw` option can be used to implement
|
841
|
+
The `raw` option can be used to implement "dark mode" screens:
|
842
842
|
|
843
843
|
```js
|
844
844
|
const designSystem = {
|
@@ -851,7 +851,7 @@ const designSystem = {
|
|
851
851
|
};
|
852
852
|
```
|
853
853
|
|
854
|
-
|
854
|
+
Then, you can use the `dark:` prefix to set different styles for elements in dark mode:
|
855
855
|
|
856
856
|
```html
|
857
857
|
<div class="text-gray-700 dark:text-gray-200">
|
@@ -859,11 +859,11 @@ You can then style the element differently in dark mode using the `dark:` prefix
|
|
859
859
|
</div>
|
860
860
|
```
|
861
861
|
|
862
|
-
|
862
|
+
Please note that since these screen variants are implemented in TailwindCSS, **it is not possible to use this method to combine breakpoints with dark mode**, e.g. `md:dark:text-gray-300` will not work.
|
863
863
|
|
864
864
|
#### Colors
|
865
865
|
|
866
|
-
The `colors` property allows you to customize the global palette
|
866
|
+
The `colors` property allows you to customize the global color palette for your project.
|
867
867
|
|
868
868
|
```js
|
869
869
|
const designSystem = {
|
@@ -884,11 +884,11 @@ const designSystem = {
|
|
884
884
|
|
885
885
|
By default, these colors are inherited by the `backgroundColor`, `textColor`, and `borderColor` core plugins.
|
886
886
|
|
887
|
-
|
887
|
+
For more information, see [Customizing Colors](https://tailwindcss.com/docs/customizing-colors).
|
888
888
|
|
889
889
|
#### Spacing
|
890
890
|
|
891
|
-
|
891
|
+
Use the `space` property to customize the global spacing and scale ratios for your project:
|
892
892
|
|
893
893
|
```js
|
894
894
|
const designSystem = {
|
@@ -918,13 +918,13 @@ const designSystem = {
|
|
918
918
|
|
919
919
|
By default, these values are inherited by the `padding`, `margin`, `negativeMargin`, `width`, and `height` core plugins.
|
920
920
|
|
921
|
-
|
921
|
+
For more information, see [Customizing Spacing](https://tailwindcss.com/docs/customizing-spacing).
|
922
922
|
|
923
|
-
#### Core
|
923
|
+
#### Core Plugins
|
924
924
|
|
925
|
-
The rest of the
|
925
|
+
The rest of the theme section is used to configure the values available for each core plugin.
|
926
926
|
|
927
|
-
For example, the `borderRadius` property allows you to customize the `utilities`
|
927
|
+
For example, the `borderRadius` property allows you to customize the `utilities` for the generated border radius:
|
928
928
|
|
929
929
|
```js
|
930
930
|
const designSystem = {
|
@@ -938,7 +938,7 @@ const designSystem = {
|
|
938
938
|
};
|
939
939
|
```
|
940
940
|
|
941
|
-
**
|
941
|
+
**The property name determines the suffix of the generated classes, and the value determines the value of the actual CSS declaration.** The `borderRadius` configuration example above will generate the following CSS classes:
|
942
942
|
|
943
943
|
```css
|
944
944
|
.rounded-none {
|
@@ -958,17 +958,17 @@ const designSystem = {
|
|
958
958
|
}
|
959
959
|
```
|
960
960
|
|
961
|
-
You
|
961
|
+
You may notice that the `rounded` class without a suffix is created using the `default` property in the theme configuration. This is a common convention in Tailwind CSS that many (although not all) core plugins support.
|
962
962
|
|
963
|
-
|
963
|
+
For more information on customizing specific core plugins, see the documentation for that plugin.
|
964
964
|
|
965
|
-
###
|
965
|
+
### Customizing the Default Configuration
|
966
966
|
|
967
|
-
Out of the box, your project will
|
967
|
+
Out of the box, your project will inherit values from the default theme configuration. If you want to customize the default theme, there are a few different options depending on your goals.
|
968
968
|
|
969
|
-
####
|
969
|
+
#### Overriding Default Configuration
|
970
970
|
|
971
|
-
To override
|
971
|
+
To override an option in the default configuration, add the property you want to override to `designSystem`:
|
972
972
|
|
973
973
|
```ts title="modern.config.ts"
|
974
974
|
const designSystem = {
|
@@ -990,15 +990,15 @@ export default defineConfig({
|
|
990
990
|
});
|
991
991
|
```
|
992
992
|
|
993
|
-
This completely
|
993
|
+
This will completely replace the default property configuration, so in the example above, the default `opacity utilities` will not be generated.
|
994
994
|
|
995
|
-
Any properties you don't provide will
|
995
|
+
Any properties you don't provide will still inherit from the default theme, so in the example above, the default theme configuration for colors, spacing, border radius, background positions, etc. will be preserved.
|
996
996
|
|
997
|
-
####
|
997
|
+
#### Extending Default Configuration
|
998
998
|
|
999
|
-
If you want to keep the default
|
999
|
+
If you want to keep the default values for a theme option but add new values, add the extension under the `designSystem.extend` property.
|
1000
1000
|
|
1001
|
-
For example, if you want to add an additional breakpoint but keep the existing
|
1001
|
+
For example, if you want to add an additional breakpoint but keep the existing ones, you can extend the `screens` property:
|
1002
1002
|
|
1003
1003
|
```ts title="modern.config.ts"
|
1004
1004
|
const designSystem = {
|
@@ -1017,7 +1017,7 @@ export default defineConfig({
|
|
1017
1017
|
});
|
1018
1018
|
```
|
1019
1019
|
|
1020
|
-
|
1020
|
+
Of course, you can override some parts of the default theme and extend other parts of the default theme in the same configuration:
|
1021
1021
|
|
1022
1022
|
```ts title="modern.config.ts"
|
1023
1023
|
const designSystem = {
|
@@ -1043,11 +1043,11 @@ export default defineConfig({
|
|
1043
1043
|
});
|
1044
1044
|
```
|
1045
1045
|
|
1046
|
-
####
|
1046
|
+
#### Referencing Other Values
|
1047
1047
|
|
1048
|
-
If you need to reference another value in
|
1048
|
+
If you need to reference another value in your configuration, you can do so by providing a closure function instead of a static value. The function will receive the `theme()` function as an argument, which you can use to look up other values in the configuration using dot notation.
|
1049
1049
|
|
1050
|
-
For example, you can generate
|
1050
|
+
For example, you can generate `fill` utilities for each color in your palette by referencing `theme('colors')` on the `fill` configuration:
|
1051
1051
|
|
1052
1052
|
```ts title="modern.config.ts"
|
1053
1053
|
const designSystem = {
|
@@ -1064,11 +1064,11 @@ export default defineConfig({
|
|
1064
1064
|
});
|
1065
1065
|
```
|
1066
1066
|
|
1067
|
-
The `theme()` function
|
1067
|
+
The `theme()` function attempts to find the value you're looking for from the fully merged configuration object, so it can reference your own custom settings as well as default theme values. It also works recursively, so as long as there's a static value at the end of the chain, it can resolve the value you're looking for.
|
1068
1068
|
|
1069
|
-
**
|
1069
|
+
**Referencing Default Configuration**
|
1070
1070
|
|
1071
|
-
If you want to reference a value
|
1071
|
+
If you want to reference a value from the default configuration for any reason, you can import it from `tailwindcss/defaultTheme`. A useful example is if you want to add a font from the fonts provided by the default configuration:
|
1072
1072
|
|
1073
1073
|
```ts title="modern.config.ts"
|
1074
1074
|
const defaultTheme = require('tailwindcss/defaultTheme');
|
@@ -1088,9 +1088,9 @@ export default defineConfig({
|
|
1088
1088
|
});
|
1089
1089
|
```
|
1090
1090
|
|
1091
|
-
####
|
1091
|
+
#### Disabling Entire Core Plugins
|
1092
1092
|
|
1093
|
-
If you don't want to generate any classes for a core plugin, it's
|
1093
|
+
If you don't want to generate any classes for a particular core plugin, it's best to set that plugin to `false` in the `corePlugins` configuration rather than providing an empty object for that property in the configuration:
|
1094
1094
|
|
1095
1095
|
```js
|
1096
1096
|
// Don't assign an empty object in your theme configuration
|
@@ -1107,13 +1107,13 @@ const designSyttem = {
|
|
1107
1107
|
};
|
1108
1108
|
```
|
1109
1109
|
|
1110
|
-
The end result is the same, but since many core plugins don't expose any configuration, they can only be disabled using `corePlugins
|
1110
|
+
The end result is the same, but since many core plugins don't expose any configuration, they can only be disabled using `corePlugins`, so it's best to be consistent.
|
1111
1111
|
|
1112
|
-
####
|
1112
|
+
#### Adding Your Own Keys
|
1113
1113
|
|
1114
|
-
In many cases,
|
1114
|
+
In many cases, adding your own properties to the configuration object can be useful.
|
1115
1115
|
|
1116
|
-
|
1116
|
+
One example of this is adding a new property for reuse between multiple core plugins. For example, you could extract a `positions` object that both the `backgroundPosition` and `objectPosition` plugins could reference:
|
1117
1117
|
|
1118
1118
|
```js
|
1119
1119
|
const designSystem = {
|
@@ -1133,7 +1133,7 @@ const designSystem = {
|
|
1133
1133
|
};
|
1134
1134
|
```
|
1135
1135
|
|
1136
|
-
Another example is adding new
|
1136
|
+
Another example is adding new properties for reference in custom plugins. For example, if you've written a gradient plugin for your project, you could add a `gradients` property to the theme object that the plugin references:
|
1137
1137
|
|
1138
1138
|
```ts title="modern.config.ts"
|
1139
1139
|
const designSystem = {
|
@@ -1156,20 +1156,20 @@ export default defineConfig({
|
|
1156
1156
|
});
|
1157
1157
|
```
|
1158
1158
|
|
1159
|
-
###
|
1159
|
+
### Configuration Reference
|
1160
1160
|
|
1161
|
-
|
1161
|
+
In addition to `screens`, `colors`, and `spacing`, all properties in the configuration object map to core plugins in TailwindCSS. Because many plugins are responsible for CSS properties that only accept a set of static values (e.g. `float`), not every plugin has a corresponding property in the theme object.
|
1162
1162
|
|
1163
|
-
All of these properties can also be
|
1163
|
+
All of these properties can also be extended from the default theme under the `designSystem.extend` property.
|
1164
1164
|
|
1165
|
-
|
1165
|
+
For a complete list of all properties and their effects, see this [link](https://tailwindcss.com/docs/theme#configuration-reference).
|
1166
1166
|
|
1167
|
-
### Additional
|
1167
|
+
### Additional Configuration
|
1168
1168
|
|
1169
|
-
In addition to the
|
1169
|
+
In addition to the configuration that is the same as Tailwind CSS Theme, there is additional configuration provided by Modern.js.
|
1170
1170
|
|
1171
1171
|
#### source.designSystem.supportStyledComponents
|
1172
1172
|
|
1173
|
-
|
1173
|
+
This configuration is of type `boolean` and defaults to `false`.
|
1174
1174
|
|
1175
|
-
When
|
1175
|
+
When this configuration value is `true`, a `styled-components` `ThemeProvider` component is provided at the outermost layer of the application at runtime, and the `Theme Token` object generated through `designSystem` is injected.
|
@@ -7,13 +7,14 @@ sidebar_label: disableDefaultEntries
|
|
7
7
|
- **Type:** `boolean`
|
8
8
|
- **Default:** `false`
|
9
9
|
|
10
|
-
Used to disable the
|
10
|
+
Used to disable the functionality of automatically identifying page entry points based on directory structure.
|
11
11
|
|
12
12
|
:::info
|
13
|
-
By default, Modern.js
|
13
|
+
By default, Modern.js automatically determines the entry points of pages based on directory conventions, as described in [Entries](/guides/concept/entries).
|
14
|
+
|
14
15
|
:::
|
15
16
|
|
16
|
-
|
17
|
+
To disable this default behavior, set the following:
|
17
18
|
|
18
19
|
```ts title="modern.config.ts"
|
19
20
|
export default defineConfig({
|
@@ -23,9 +24,9 @@ export default defineConfig({
|
|
23
24
|
});
|
24
25
|
```
|
25
26
|
|
26
|
-
After
|
27
|
+
After disabling the default behavior, you will need to use the [`source.entries`](/configure/app/source/entries) configuration to define custom entry points.
|
27
28
|
|
28
29
|
:::warning
|
29
|
-
We recommend using the directory
|
30
|
+
We recommend organizing your code using the directory conventions provided by Modern.js to make better use of the framework's functionality and to avoid some redundant configurations.
|
30
31
|
|
31
32
|
:::
|
@@ -7,9 +7,9 @@ sidebar_label: disableEntryDirs
|
|
7
7
|
- **Type:** `string[]`
|
8
8
|
- **Default:** `[]`
|
9
9
|
|
10
|
-
By default, application
|
10
|
+
By default, Modern.js identifies the application entry point based on the `src` directory. You can use this option to prevent some directories from being recognized as application entry points.
|
11
11
|
|
12
|
-
For example,
|
12
|
+
For example, with the following configuration and directory structure:
|
13
13
|
|
14
14
|
```ts title="modern.config.ts"
|
15
15
|
export default defineConfig({
|
@@ -28,11 +28,11 @@ export default defineConfig({
|
|
28
28
|
└── env.d.ts
|
29
29
|
```
|
30
30
|
|
31
|
-
|
31
|
+
Without setting this configuration option, Modern.js will produce two entries based on the project directory:
|
32
32
|
|
33
33
|
- one
|
34
34
|
- two
|
35
35
|
|
36
|
-
|
36
|
+
After setting this configuration option, the `src/one` directory will not be recognized as an entry directory.
|
37
37
|
|
38
|
-
A common
|
38
|
+
A common use case is to configure the `src/common` and `src/components` directories in this option to prevent them from being recognized as application entry points.
|
@@ -7,17 +7,17 @@ sidebar_label: enableAsyncEntry
|
|
7
7
|
- **Type:** `boolean`
|
8
8
|
- **Default:** `false`
|
9
9
|
|
10
|
-
This option is used
|
10
|
+
This option is used for webpack Module Federation scenario.
|
11
11
|
|
12
|
-
When this option is
|
12
|
+
When this option is enabled, Modern.js will wrap the automatically generated entry files with Dynamic Imports (Asynchronous Boundaries), allowing page code to consume remote modules generated by Module Federation.
|
13
13
|
|
14
|
-
## Background
|
14
|
+
## Background
|
15
15
|
|
16
|
-
If you
|
16
|
+
If you are not familiar with webpack Module Federation, please read the [Module Federation documentation](https://webpack.js.org/concepts/module-federation/).
|
17
17
|
|
18
18
|
## Example
|
19
19
|
|
20
|
-
First,
|
20
|
+
First, enable this option in the configuration file:
|
21
21
|
|
22
22
|
```ts title="modern.config.ts"
|
23
23
|
export default defineConfig({
|
@@ -27,7 +27,7 @@ export default defineConfig({
|
|
27
27
|
});
|
28
28
|
```
|
29
29
|
|
30
|
-
Then
|
30
|
+
Then run the `dev` or `build` command, and you will see that the files automatically generated by Modern.js have the following structure:
|
31
31
|
|
32
32
|
```bash
|
33
33
|
node_modules
|
@@ -38,15 +38,15 @@ node_modules
|
|
38
38
|
└─ index.html
|
39
39
|
```
|
40
40
|
|
41
|
-
The `index.js`
|
41
|
+
The contents of `index.js` are as follows:
|
42
42
|
|
43
43
|
```js
|
44
44
|
import('./bootstrap.jsx');
|
45
45
|
```
|
46
46
|
|
47
|
-
At this point, you can consume any remote
|
47
|
+
At this point, you can consume any remote module in the current page.
|
48
48
|
|
49
49
|
:::info
|
50
|
-
Modern.js
|
50
|
+
Modern.js does not have webpack's ModuleFederationPlugin plugin built in. Please configure the ModuleFederationPlugin yourself via [tools.webpackChain](/configure/app/tools/webpack-chain).
|
51
51
|
|
52
52
|
:::
|
@@ -7,9 +7,9 @@ sidebar_label: entriesDir
|
|
7
7
|
- **Type:** `string`
|
8
8
|
- **Default:** `./src`
|
9
9
|
|
10
|
-
Modern.js
|
10
|
+
By default, Modern.js scans the `src` directory to identify page entries. You can customize the directory used for identifying page entries with this option.
|
11
11
|
|
12
|
-
For example,
|
12
|
+
For example, with the following configuration and directory structure:
|
13
13
|
|
14
14
|
```ts title="modern.config.ts"
|
15
15
|
export default defineConfig({
|
@@ -29,7 +29,7 @@ export default defineConfig({
|
|
29
29
|
└── App.tsx
|
30
30
|
```
|
31
31
|
|
32
|
-
Modern.js will generate the build
|
32
|
+
Modern.js will generate the build entries `a` and `b` based on the `./src/pages` directory structure. The result is as follows:
|
33
33
|
|
34
34
|
```js
|
35
35
|
const entry = {
|
@@ -18,20 +18,20 @@ type Entries = Record<
|
|
18
18
|
>;
|
19
19
|
```
|
20
20
|
|
21
|
-
- **Default:**
|
21
|
+
- **Default:** The entry object calculated based on the directory structure of the current project.
|
22
22
|
|
23
23
|
Used to configure custom page entries.
|
24
24
|
|
25
25
|
:::tip When to use
|
26
|
-
For most scenarios, the
|
26
|
+
For most scenarios, the entry automatically generated by Modern.js based on the directory structure can meet the requirements. For details, please refer to [Entry](/guides/concept/entries).
|
27
27
|
|
28
|
-
If you need to customize
|
28
|
+
If you need to customize page entries, you can set them through this option.
|
29
29
|
|
30
30
|
:::
|
31
31
|
|
32
32
|
## String
|
33
33
|
|
34
|
-
When the value of `entries` object is `string
|
34
|
+
When the value of the `entries` object is of type `string`, it represents the file path of the entry module:
|
35
35
|
|
36
36
|
```ts title="modern.config.ts"
|
37
37
|
import { defineConfig } from '@modern-js/app-tools';
|
@@ -47,9 +47,9 @@ export default defineConfig({
|
|
47
47
|
});
|
48
48
|
```
|
49
49
|
|
50
|
-
By default, the configured entry is equivalent to `App.[jt]sx`, that
|
50
|
+
By default, the configured entry is equivalent to `App.[jt]sx`, which means that the specified entry file **only needs to export the root component of the application**.
|
51
51
|
|
52
|
-
For example the following directory structure:
|
52
|
+
For example, the following directory structure:
|
53
53
|
|
54
54
|
```bash
|
55
55
|
.
|
@@ -60,9 +60,9 @@ For example the following directory structure:
|
|
60
60
|
└── package.json
|
61
61
|
```
|
62
62
|
|
63
|
-
The above directory does not conform to the directory structure convention of Modern.js,
|
63
|
+
The above directory does not conform to the directory structure convention of Modern.js, so Modern.js will not get any default entries when analyzing the directory structure.
|
64
64
|
|
65
|
-
|
65
|
+
If you do not want to change the directory structure (such as project migration), you can customize the entry through `source.entries`:
|
66
66
|
|
67
67
|
```ts title="modern.config.ts"
|
68
68
|
export default defineConfig({
|
@@ -78,11 +78,11 @@ export default defineConfig({
|
|
78
78
|
|
79
79
|
## Object
|
80
80
|
|
81
|
-
When the value is `Object`, the following
|
81
|
+
When the value is `Object`, the following attributes can be configured:
|
82
82
|
|
83
|
-
- `entry`: `string`, entry file path.
|
84
|
-
- `disableMount`: `boolean = false`,
|
85
|
-
- `customBootstrap`: `string = ''`, [
|
83
|
+
- `entry`: `string`, the entry file path.
|
84
|
+
- `disableMount`: `boolean = false`, disable Modern.js's behavior of automatically generating entry code.
|
85
|
+
- `customBootstrap`: `string = ''`, specify the file path of [custom Bootstrap](/guides/concept/entries#custom-bootstrap).
|
86
86
|
|
87
87
|
```ts title="modern.config.ts"
|
88
88
|
import { defineConfig } from '@modern-js/app-tools';
|
@@ -95,6 +95,7 @@ export default defineConfig({
|
|
95
95
|
entry: './src/home/test/App.tsx',
|
96
96
|
},
|
97
97
|
},
|
98
|
+
// Disable default entry scanning
|
98
99
|
disableDefaultEntries: true,
|
99
100
|
},
|
100
101
|
});
|
@@ -102,9 +103,9 @@ export default defineConfig({
|
|
102
103
|
|
103
104
|
### Disable entry file generation
|
104
105
|
|
105
|
-
By default, the configured entry is equivalent to `App.[jt]sx`, and Modern.js will automatically generate an entry file to reference
|
106
|
+
By default, the configured entry is equivalent to `App.[jt]sx`, and Modern.js will automatically generate an entry file to reference the entry you configured.
|
106
107
|
|
107
|
-
If you want to disable the logic of Modern.js automatically generating
|
108
|
+
If you want to disable the logic of Modern.js automatically generating entry files, you can set the `disableMount` property to `true`.
|
108
109
|
|
109
110
|
```ts title="modern.config.ts"
|
110
111
|
export default defineConfig({
|
@@ -115,7 +116,7 @@ export default defineConfig({
|
|
115
116
|
disableMount: true,
|
116
117
|
},
|
117
118
|
},
|
118
|
-
// Disable default
|
119
|
+
// Disable default entry scanning
|
119
120
|
disableDefaultEntries: true,
|
120
121
|
},
|
121
122
|
});
|
@@ -137,6 +138,7 @@ export default defineConfig({
|
|
137
138
|
entry: './src/about',
|
138
139
|
},
|
139
140
|
},
|
141
|
+
// Disable default entry scanning
|
140
142
|
disableDefaultEntries: true,
|
141
143
|
},
|
142
144
|
});
|
@@ -148,9 +150,9 @@ After setting `source.entries`, if `disableDefaultEntries: true` is not set, Mod
|
|
148
150
|
|
149
151
|
The merge rule is:
|
150
152
|
|
151
|
-
- Compare the entry
|
153
|
+
- Compare the entry paths set by the custom entry setting and the default entry path. When the entry paths are the same, the custom entry will override the default entry.
|
152
154
|
|
153
|
-
For example the following directory structure:
|
155
|
+
For example, the following directory structure:
|
154
156
|
|
155
157
|
```bash
|
156
158
|
.
|
@@ -162,7 +164,7 @@ For example the following directory structure:
|
|
162
164
|
└── package.json
|
163
165
|
```
|
164
166
|
|
165
|
-
Modern.js will analyze the `src/` directory
|
167
|
+
Modern.js will analyze the `src/` directory and get the default entries `chat` and `home`. When the user configures as follows in the `modern.config.ts` file:
|
166
168
|
|
167
169
|
```ts title="modern.config.ts"
|
168
170
|
import { defineConfig } from '@modern-js/app-tools';
|
@@ -176,7 +178,7 @@ export default defineConfig({
|
|
176
178
|
};
|
177
179
|
```
|
178
180
|
|
179
|
-
|
181
|
+
It can be seen that the path of the custom entry `index` is the same as the path of the default entry `home`. During the merge process, `index` will override `home`, and the final entry is as follows:
|
180
182
|
|
181
183
|
- `chat -> ./src/chat/App.tsx`
|
182
184
|
- `index -> ./src/home/index.ts`
|
@@ -22,8 +22,8 @@ When using Rspack as the bundler, SWC will be used for transpiling and compressi
|
|
22
22
|
First, you need to execute `pnpm run new` to enable the SWC compile:
|
23
23
|
|
24
24
|
```bash
|
25
|
-
?
|
26
|
-
?
|
25
|
+
? Please select the operation you want: Enable features
|
26
|
+
? Please select the feature name: Enable SWC Compile
|
27
27
|
```
|
28
28
|
|
29
29
|
After the installation, please register the SWC plugin in the `modern.config.ts` file, then the SWC compilation and compression will be enabled.
|