@modern-js/main-doc 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +1 -1
- package/en/components/global-proxy-config.mdx +2 -2
- package/en/configure/app/auto-load-plugin.mdx +2 -2
- package/en/configure/app/bff/prefix.mdx +2 -2
- package/en/configure/app/bff/proxy.mdx +2 -2
- package/en/configure/app/builder-plugins.mdx +2 -2
- package/en/configure/app/deploy/microFrontend.mdx +6 -6
- package/en/configure/app/dev/asset-prefix.mdx +4 -3
- package/en/configure/app/dev/hmr.mdx +4 -3
- package/en/configure/app/dev/https.mdx +4 -3
- package/en/configure/app/dev/port.mdx +4 -3
- package/en/configure/app/dev/progress-bar.mdx +4 -3
- package/en/configure/app/dev/start-url.mdx +4 -3
- package/en/configure/app/experiments/lazy-compilation.mdx +4 -3
- package/en/configure/app/html/app-icon.mdx +4 -3
- package/en/configure/app/html/crossorigin.mdx +4 -3
- package/en/configure/app/html/disable-html-folder.mdx +4 -3
- package/en/configure/app/html/favicon-by-entries.mdx +4 -3
- package/en/configure/app/html/favicon.mdx +4 -3
- package/en/configure/app/html/inject-by-entries.mdx +4 -3
- package/en/configure/app/html/inject.mdx +4 -3
- package/en/configure/app/html/meta-by-entries.mdx +4 -3
- package/en/configure/app/html/meta.mdx +4 -3
- package/en/configure/app/html/mount-id.mdx +4 -3
- package/en/configure/app/html/tags-by-entries.mdx +4 -3
- package/en/configure/app/html/tags.mdx +4 -3
- package/en/configure/app/html/template-by-entries.mdx +4 -3
- package/en/configure/app/html/template-parameters-by-entries.mdx +4 -3
- package/en/configure/app/html/template-parameters.mdx +4 -3
- package/en/configure/app/html/template.mdx +4 -3
- package/en/configure/app/html/title-by-entries.mdx +4 -3
- package/en/configure/app/html/title.mdx +4 -3
- package/en/configure/app/output/asset-prefix.mdx +4 -3
- package/en/configure/app/output/assets-retry.mdx +4 -3
- package/en/configure/app/output/charset.mdx +4 -3
- package/en/configure/app/output/clean-dist-path.mdx +4 -3
- package/en/configure/app/output/convert-to-rem.mdx +4 -3
- package/en/configure/app/output/copy.mdx +4 -3
- package/en/configure/app/output/css-module-local-ident-name.mdx +4 -3
- package/en/configure/app/output/data-uri-limit.mdx +4 -3
- package/en/configure/app/output/disable-css-extract.mdx +4 -3
- package/en/configure/app/output/disable-css-module-extension.mdx +4 -3
- package/en/configure/app/output/disable-filename-hash.mdx +4 -3
- package/en/configure/app/output/disable-inline-runtime-chunk.mdx +4 -3
- package/en/configure/app/output/disable-minimize.mdx +4 -3
- package/en/configure/app/output/disable-node-polyfill.mdx +2 -2
- package/en/configure/app/output/disable-source-map.mdx +4 -3
- package/en/configure/app/output/disable-ts-checker.mdx +4 -3
- package/en/configure/app/output/dist-path.mdx +4 -3
- package/en/configure/app/output/enable-asset-fallback.mdx +4 -3
- package/en/configure/app/output/enable-asset-manifest.mdx +4 -3
- package/en/configure/app/output/enable-css-module-tsdeclaration.mdx +4 -3
- package/en/configure/app/output/enable-inline-scripts.mdx +4 -3
- package/en/configure/app/output/enable-inline-styles.mdx +4 -3
- package/en/configure/app/output/enable-latest-decorators.mdx +4 -3
- package/en/configure/app/output/externals.mdx +4 -3
- package/en/configure/app/output/filename.mdx +4 -3
- package/en/configure/app/output/legal-comments.mdx +4 -3
- package/en/configure/app/output/override-browserslist.mdx +4 -3
- package/en/configure/app/output/polyfill.mdx +4 -3
- package/en/configure/app/output/ssg.mdx +2 -2
- package/en/configure/app/output/svg-default-export.mdx +4 -3
- package/en/configure/app/performance/build-cache.mdx +4 -3
- package/en/configure/app/performance/bundle-analyze.mdx +4 -3
- package/en/configure/app/performance/chunk-split.mdx +4 -3
- package/en/configure/app/performance/print-file-size.mdx +4 -3
- package/en/configure/app/performance/profile.mdx +4 -3
- package/en/configure/app/performance/remove-console.mdx +4 -3
- package/en/configure/app/performance/remove-moment-locale.mdx +4 -3
- package/en/configure/app/plugins.mdx +2 -2
- package/en/configure/app/runtime/intro.mdx +2 -2
- package/en/configure/app/runtime/master-app.mdx +1 -2
- package/en/configure/app/runtime/router.mdx +6 -6
- package/en/configure/app/runtime/state.mdx +14 -14
- package/en/configure/app/security/check-syntax.mdx +13 -0
- package/en/configure/app/security/sri.mdx +4 -3
- package/en/configure/app/server/base-url.mdx +2 -2
- package/en/configure/app/server/enable-framework-ext.mdx +2 -2
- package/en/configure/app/server/port.mdx +2 -2
- package/en/configure/app/server/public-routes.mdx +2 -2
- package/en/configure/app/server/routes.mdx +2 -2
- package/en/configure/app/server/ssr-by-entries.mdx +2 -2
- package/en/configure/app/server/ssr.mdx +2 -2
- package/en/configure/app/source/alias.mdx +4 -3
- package/en/configure/app/source/compile-js-data-uri.mdx +4 -3
- package/en/configure/app/source/config-dir.mdx +2 -2
- package/en/configure/app/source/define.mdx +4 -3
- package/en/configure/app/source/design-system.mdx +2 -2
- package/en/configure/app/source/disable-default-entries.mdx +2 -2
- package/en/configure/app/source/disable-entry-dirs.mdx +2 -2
- package/en/configure/app/source/enable-async-entry.mdx +2 -2
- package/en/configure/app/source/entries-dir.mdx +2 -2
- package/en/configure/app/source/entries.mdx +2 -2
- package/en/configure/app/source/exclude.mdx +4 -3
- package/en/configure/app/source/global-vars.mdx +4 -3
- package/en/configure/app/source/include.mdx +4 -3
- package/en/configure/app/source/module-scopes.mdx +4 -3
- package/en/configure/app/source/pre-entry.mdx +4 -3
- package/en/configure/app/source/resolve-extension-prefix.mdx +4 -3
- package/en/configure/app/source/resolve-main-fields.mdx +4 -3
- package/en/configure/app/testing/transformer.mdx +2 -2
- package/en/configure/app/tools/autoprefixer.mdx +4 -3
- package/en/configure/app/tools/babel.mdx +4 -3
- package/en/configure/app/tools/css-extract.mdx +4 -3
- package/en/configure/app/tools/css-loader.mdx +4 -3
- package/en/configure/app/tools/dev-server.mdx +4 -3
- package/en/configure/app/tools/esbuild.mdx +2 -2
- package/en/configure/app/tools/html-plugin.mdx +4 -3
- package/en/configure/app/tools/inspector.mdx +4 -3
- package/en/configure/app/tools/jest.mdx +2 -2
- package/en/configure/app/tools/less.mdx +4 -3
- package/en/configure/app/tools/minify-css.mdx +4 -3
- package/en/configure/app/tools/postcss.mdx +4 -3
- package/en/configure/app/tools/pug.mdx +4 -3
- package/en/configure/app/tools/sass.mdx +4 -3
- package/en/configure/app/tools/style-loader.mdx +4 -3
- package/en/configure/app/tools/styled-components.mdx +4 -3
- package/en/configure/app/tools/swc.mdx +2 -2
- package/en/configure/app/tools/tailwindcss.mdx +8 -16
- package/en/configure/app/tools/terser.mdx +4 -3
- package/en/configure/app/tools/ts-checker.mdx +4 -3
- package/en/configure/app/tools/ts-loader.mdx +4 -3
- package/en/configure/app/tools/webpack-chain.mdx +4 -3
- package/en/configure/app/tools/webpack.mdx +4 -3
- package/en/configure/app/usage.mdx +54 -8
- package/en/guides/basic-features/builder.mdx +3 -3
- package/en/guides/topic-detail/generator/config/common.mdx +12 -12
- package/package.json +3 -3
- package/scripts/config.ts +5 -4
- package/scripts/summary.en.json +1 -1
- package/scripts/summary.zh.json +1 -1
- package/zh/apis/app/commands/test.mdx +1 -1
- package/zh/apis/app/hooks/api/functions/api.mdx +2 -2
- package/zh/apis/app/hooks/api/test.mdx +1 -1
- package/zh/apis/app/hooks/config/storybook.mdx +1 -1
- package/zh/apis/app/hooks/config/upload.mdx +1 -1
- package/zh/apis/app/hooks/server/test.mdx +1 -1
- package/zh/apis/app/hooks/src/stories.mdx +1 -1
- package/zh/apis/app/hooks/src/test.mdx +1 -1
- package/zh/apis/app/runtime/testing/cleanup.mdx +1 -1
- package/zh/apis/monorepo/commands/bump.mdx +1 -1
- package/zh/apis/monorepo/commands/change.mdx +1 -1
- package/zh/apis/monorepo/hooks/apps.mdx +1 -1
- package/zh/apis/monorepo/hooks/examples.mdx +1 -1
- package/zh/apis/monorepo/hooks/features.mdx +1 -1
- package/zh/apis/monorepo/hooks/packages.mdx +1 -1
- package/zh/components/global-proxy-config.mdx +3 -3
- package/zh/configure/app/auto-load-plugin.mdx +2 -2
- package/zh/configure/app/bff/prefix.mdx +2 -2
- package/zh/configure/app/bff/proxy.mdx +3 -3
- package/zh/configure/app/builder-plugins.mdx +2 -2
- package/zh/configure/app/deploy/microFrontend.mdx +6 -6
- package/zh/configure/app/dev/asset-prefix.mdx +4 -3
- package/zh/configure/app/dev/hmr.mdx +4 -3
- package/zh/configure/app/dev/https.mdx +4 -3
- package/zh/configure/app/dev/port.mdx +4 -3
- package/zh/configure/app/dev/progress-bar.mdx +4 -3
- package/zh/configure/app/dev/start-url.mdx +4 -3
- package/zh/configure/app/experiments/lazy-compilation.mdx +4 -3
- package/zh/configure/app/html/app-icon.mdx +4 -3
- package/zh/configure/app/html/crossorigin.mdx +4 -3
- package/zh/configure/app/html/disable-html-folder.mdx +4 -3
- package/zh/configure/app/html/favicon-by-entries.mdx +4 -3
- package/zh/configure/app/html/favicon.mdx +4 -3
- package/zh/configure/app/html/inject-by-entries.mdx +4 -3
- package/zh/configure/app/html/inject.mdx +4 -3
- package/zh/configure/app/html/meta-by-entries.mdx +4 -3
- package/zh/configure/app/html/meta.mdx +4 -3
- package/zh/configure/app/html/mount-id.mdx +4 -3
- package/zh/configure/app/html/tags-by-entries.mdx +4 -3
- package/zh/configure/app/html/tags.mdx +4 -3
- package/zh/configure/app/html/template-by-entries.mdx +4 -3
- package/zh/configure/app/html/template-parameters-by-entries.mdx +4 -3
- package/zh/configure/app/html/template-parameters.mdx +4 -3
- package/zh/configure/app/html/template.mdx +4 -3
- package/zh/configure/app/html/title-by-entries.mdx +4 -3
- package/zh/configure/app/html/title.mdx +4 -3
- package/zh/configure/app/output/asset-prefix.mdx +4 -3
- package/zh/configure/app/output/assets-retry.mdx +4 -3
- package/zh/configure/app/output/charset.mdx +4 -3
- package/zh/configure/app/output/clean-dist-path.mdx +4 -3
- package/zh/configure/app/output/convert-to-rem.mdx +4 -3
- package/zh/configure/app/output/copy.mdx +4 -3
- package/zh/configure/app/output/css-module-local-ident-name.mdx +4 -3
- package/zh/configure/app/output/data-uri-limit.mdx +4 -3
- package/zh/configure/app/output/disable-css-extract.mdx +4 -3
- package/zh/configure/app/output/disable-css-module-extension.mdx +4 -3
- package/zh/configure/app/output/disable-filename-hash.mdx +4 -3
- package/zh/configure/app/output/disable-inline-runtime-chunk.mdx +4 -3
- package/zh/configure/app/output/disable-minimize.mdx +4 -3
- package/zh/configure/app/output/disable-node-polyfill.mdx +2 -2
- package/zh/configure/app/output/disable-source-map.mdx +4 -3
- package/zh/configure/app/output/disable-ts-checker.mdx +4 -3
- package/zh/configure/app/output/dist-path.mdx +4 -3
- package/zh/configure/app/output/enable-asset-fallback.mdx +4 -3
- package/zh/configure/app/output/enable-asset-manifest.mdx +4 -3
- package/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +4 -3
- package/zh/configure/app/output/enable-inline-scripts.mdx +4 -3
- package/zh/configure/app/output/enable-inline-styles.mdx +4 -3
- package/zh/configure/app/output/enable-latest-decorators.mdx +4 -3
- package/zh/configure/app/output/externals.mdx +4 -3
- package/zh/configure/app/output/filename.mdx +4 -3
- package/zh/configure/app/output/legal-comments.mdx +4 -3
- package/zh/configure/app/output/override-browserslist.mdx +4 -3
- package/zh/configure/app/output/polyfill.mdx +4 -3
- package/zh/configure/app/output/ssg.mdx +2 -2
- package/zh/configure/app/output/svg-default-export.mdx +4 -3
- package/zh/configure/app/performance/build-cache.mdx +4 -3
- package/zh/configure/app/performance/bundle-analyze.mdx +4 -3
- package/zh/configure/app/performance/chunk-split.mdx +4 -3
- package/zh/configure/app/performance/print-file-size.mdx +4 -3
- package/zh/configure/app/performance/profile.mdx +4 -3
- package/zh/configure/app/performance/remove-console.mdx +4 -3
- package/zh/configure/app/performance/remove-moment-locale.mdx +4 -3
- package/zh/configure/app/plugins.mdx +2 -2
- package/zh/configure/app/runtime/intro.mdx +3 -3
- package/zh/configure/app/runtime/master-app.mdx +1 -1
- package/zh/configure/app/runtime/router.mdx +6 -6
- package/zh/configure/app/runtime/state.mdx +14 -14
- package/zh/configure/app/security/check-syntax.mdx +13 -0
- package/zh/configure/app/security/sri.mdx +4 -3
- package/zh/configure/app/server/base-url.mdx +2 -2
- package/zh/configure/app/server/enable-framework-ext.mdx +2 -2
- package/zh/configure/app/server/port.mdx +2 -2
- package/zh/configure/app/server/public-routes.mdx +2 -2
- package/zh/configure/app/server/routes.mdx +2 -2
- package/zh/configure/app/server/ssr-by-entries.mdx +3 -3
- package/zh/configure/app/server/ssr.mdx +2 -2
- package/zh/configure/app/source/alias.mdx +4 -3
- package/zh/configure/app/source/compile-js-data-uri.mdx +4 -3
- package/zh/configure/app/source/config-dir.mdx +2 -2
- package/zh/configure/app/source/define.mdx +4 -3
- package/zh/configure/app/source/design-system.mdx +2 -2
- package/zh/configure/app/source/disable-default-entries.mdx +2 -2
- package/zh/configure/app/source/disable-entry-dirs.mdx +2 -2
- package/zh/configure/app/source/enable-async-entry.mdx +2 -2
- package/zh/configure/app/source/entries-dir.mdx +2 -2
- package/zh/configure/app/source/entries.mdx +2 -2
- package/zh/configure/app/source/exclude.mdx +4 -3
- package/zh/configure/app/source/global-vars.mdx +4 -3
- package/zh/configure/app/source/include.mdx +4 -3
- package/zh/configure/app/source/module-scopes.mdx +4 -3
- package/zh/configure/app/source/pre-entry.mdx +4 -3
- package/zh/configure/app/source/resolve-extension-prefix.mdx +4 -3
- package/zh/configure/app/source/resolve-main-fields.mdx +4 -3
- package/zh/configure/app/testing/transformer.mdx +2 -2
- package/zh/configure/app/tools/autoprefixer.mdx +4 -3
- package/zh/configure/app/tools/babel.mdx +4 -3
- package/zh/configure/app/tools/css-extract.mdx +4 -3
- package/zh/configure/app/tools/css-loader.mdx +4 -3
- package/zh/configure/app/tools/dev-server.mdx +4 -3
- package/zh/configure/app/tools/esbuild.mdx +2 -2
- package/zh/configure/app/tools/html-plugin.mdx +4 -3
- package/zh/configure/app/tools/inspector.mdx +4 -3
- package/zh/configure/app/tools/jest.mdx +2 -2
- package/zh/configure/app/tools/less.mdx +4 -3
- package/zh/configure/app/tools/minify-css.mdx +4 -3
- package/zh/configure/app/tools/postcss.mdx +4 -3
- package/zh/configure/app/tools/pug.mdx +4 -3
- package/zh/configure/app/tools/sass.mdx +4 -3
- package/zh/configure/app/tools/style-loader.mdx +4 -3
- package/zh/configure/app/tools/styled-components.mdx +4 -3
- package/zh/configure/app/tools/swc.mdx +2 -2
- package/zh/configure/app/tools/tailwindcss.mdx +10 -16
- package/zh/configure/app/tools/terser.mdx +4 -3
- package/zh/configure/app/tools/ts-checker.mdx +4 -3
- package/zh/configure/app/tools/ts-loader.mdx +4 -3
- package/zh/configure/app/tools/webpack-chain.mdx +4 -3
- package/zh/configure/app/tools/webpack.mdx +4 -3
- package/zh/configure/app/usage.mdx +54 -8
- package/zh/guides/advanced-features/bff/function.mdx +3 -3
- package/zh/guides/advanced-features/code-split.mdx +1 -1
- package/zh/guides/advanced-features/compatibility.mdx +1 -1
- package/zh/guides/advanced-features/eslint.mdx +3 -3
- package/zh/guides/advanced-features/ssr.mdx +1 -1
- package/zh/guides/basic-features/alias.mdx +1 -1
- package/zh/guides/basic-features/builder.mdx +2 -2
- package/zh/guides/basic-features/css/postcss.mdx +1 -1
- package/zh/guides/basic-features/html.mdx +1 -1
- package/zh/guides/topic-detail/framework-plugin/hook.mdx +1 -1
- package/zh/guides/topic-detail/generator/config/common.mdx +12 -12
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +1 -1
- package/zh/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +1 -1
- package/zh/guides/topic-detail/model/auto-actions.mdx +1 -1
- package/zh/guides/topic-detail/model/define-model.mdx +1 -1
- package/zh/guides/topic-detail/model/manage-effects.mdx +1 -1
- package/zh/guides/topic-detail/model/quick-start.mdx +2 -2
- package/zh/guides/topic-detail/model/test-model.mdx +1 -1
- package/zh/guides/topic-detail/model/use-model.mdx +3 -3
- package/zh/guides/topic-detail/monorepo/create-sub-project.mdx +2 -2
- package/zh/guides/topic-detail/monorepo/sub-project-interface.mdx +2 -2
- package/zh/tutorials/first-app/c02-component.mdx +1 -1
- package/zh/tutorials/first-app/c03-css.mdx +3 -3
- package/zh/tutorials/first-app/c04-routes.mdx +1 -1
- package/zh/tutorials/first-app/c06-model.mdx +1 -1
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: tools.terser
|
3
2
|
sidebar_label: terser
|
4
3
|
---
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
# tools.terser
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [tools.terser](https://modernjs.dev/builder/en/api/config-tools.html#tools-terser)。
|
8
9
|
:::
|
9
10
|
|
10
11
|
import Main from '@modern-js/builder-doc/docs/en/config/tools/terser.md'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: tools.tsChecker
|
3
2
|
sidebar_label: tsChecker
|
4
3
|
---
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
# tools.tsChecker
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [tools.tsChecker](https://modernjs.dev/builder/en/api/config-tools.html#tools-tschecker)。
|
8
9
|
:::
|
9
10
|
|
10
11
|
import Main from '@modern-js/builder-doc/docs/en/config/tools/tsChecker.md'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: tools.tsLoader
|
3
2
|
sidebar_label: tsLoader
|
4
3
|
---
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
# tools.tsLoader
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [tools.tsLoader](https://modernjs.dev/builder/en/api/config-tools.html#tools-tsloader)。
|
8
9
|
:::
|
9
10
|
|
10
11
|
import Main from '@modern-js/builder-doc/docs/en/config/tools/tsLoader.md'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: tools.webpackChain
|
3
2
|
sidebar_label: webpackChain
|
4
3
|
---
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
# tools.webpackChain
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [tools.webpackChain](https://modernjs.dev/builder/en/api/config-tools.html#tools-webpackchain)。
|
8
9
|
:::
|
9
10
|
|
10
11
|
import Main from '@modern-js/builder-doc/docs/en/config/tools/webpackChain.md'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: tools.webpack
|
3
2
|
sidebar_label: webpack
|
4
3
|
---
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
# tools.webpack
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [tools.webpack](https://modernjs.dev/builder/en/api/config-tools.html#tools-webpack)。
|
8
9
|
:::
|
9
10
|
|
10
11
|
import Main from '@modern-js/builder-doc/docs/en/config/tools/webpack.md'
|
@@ -8,22 +8,22 @@ There are two configurations in the Modern.js, a compile configuration and a ser
|
|
8
8
|
|
9
9
|
The compile configuration can be configured in two places:
|
10
10
|
|
11
|
+
- `modern.config.(ts|js|mjs)` file in the root path
|
11
12
|
- `package.json` file
|
12
|
-
- `modern.config.t(j)s` file in the root path
|
13
|
-
|
14
|
-
:::warning Warning
|
15
|
-
Configurations in both `package.json` and `modern.config.t(j)s` file are not supported for the same configuration. Configuration in `modern.config. t(j)s` is recommended.
|
16
13
|
|
14
|
+
:::info
|
15
|
+
Configurations in both package.json and modern.config.ts file are not supported for the same configuration. Configuration in modern.config.ts is recommended.
|
17
16
|
:::
|
18
17
|
|
19
|
-
Server runtime configuration can be configured in the `modern.server-runtime.config.
|
18
|
+
Server runtime configuration can be configured in the `modern.server-runtime.config.(ts|js|mjs)` file in the root path.
|
20
19
|
|
21
20
|
## Configure in the configuration file
|
22
21
|
|
23
|
-
Modern.js configuration files are defined in the root path of the project, and
|
22
|
+
Modern.js configuration files are defined in the root path of the project, and supports `.js`, `.ts` and `.mjs` formats:
|
24
23
|
|
25
24
|
- `modern.config.js`
|
26
25
|
- `modern.config.ts`
|
26
|
+
- `modern.config.mjs`
|
27
27
|
|
28
28
|
### modern.config.js
|
29
29
|
|
@@ -51,7 +51,7 @@ export default {
|
|
51
51
|
};
|
52
52
|
```
|
53
53
|
|
54
|
-
### modern.config.ts
|
54
|
+
### modern.config.ts (recommended)
|
55
55
|
|
56
56
|
We recommend using configuration files in `.ts` format, which provides friendly TypeScript type hints to help you avoid configuration errors.
|
57
57
|
|
@@ -87,7 +87,53 @@ In addition to configuration files, configuration options can also be set the `m
|
|
87
87
|
|
88
88
|
Due to the limitation of the JSON file format, only simple types such as numbers, strings, boolean values, arrays, etc. can be defined in `package.json`. When we need to set the value of the function type, it is recommended to set it in the Modern.js configuration file.
|
89
89
|
|
90
|
-
|
90
|
+
### Note
|
91
91
|
|
92
92
|
- It is not recommended to use both `package.json` and `modern.config.t[j]s` for configuration. If both are used and a configuration conflict occurs, Modern.js will prompt error on the command line.
|
93
93
|
- `@modern-js/runtime` exports the [defineConfig](/apis/app/runtime/app/define-config) API of the same name, please pay attention to the distinction.
|
94
|
+
|
95
|
+
## Debug configuration locally
|
96
|
+
|
97
|
+
To facilitate local debugging configuration locally, Modern.js supports creating `modern.config.local.(ts|js|mjs)` files in the root directory of the project to override `modern.config.(ts|js|mjs)` configurations.
|
98
|
+
|
99
|
+
### Example
|
100
|
+
|
101
|
+
For example, the port number is configured as `3000` in `modern.config.ts`:
|
102
|
+
|
103
|
+
```ts title="modern.config.ts"
|
104
|
+
import { defineConfig } from '@modern-js/app-tools';
|
105
|
+
|
106
|
+
export default defineConfig({
|
107
|
+
server: {
|
108
|
+
port: 3000,
|
109
|
+
},
|
110
|
+
});
|
111
|
+
```
|
112
|
+
|
113
|
+
If you need to change the port number to `3001` to debugging locally, but you don't want to change the `modern.config.ts` file of the current project, you can create a `modern.config.local.ts` file and add the following configuration:
|
114
|
+
|
115
|
+
```ts title="modern.config.local.ts"
|
116
|
+
import { defineConfig } from '@modern-js/app-tools';
|
117
|
+
|
118
|
+
export default defineConfig({
|
119
|
+
server: {
|
120
|
+
port: 3001,
|
121
|
+
},
|
122
|
+
});
|
123
|
+
```
|
124
|
+
|
125
|
+
The configuration in the `modern.config.local.ts` file will be deep merged with the configuration in `modern.config.ts` and override the configurations in `modern.config.ts`, so `server.port` will be is overridden by `3001`.
|
126
|
+
|
127
|
+
### Note
|
128
|
+
|
129
|
+
When using `modern.config.local.ts`, please note the following:
|
130
|
+
|
131
|
+
- The `modern.config.local.ts` file is only loaded when running `modern dev` or `modern start` commands, and will not be loaded when running `modern build`.
|
132
|
+
- The `modern.config.local.ts` file overrides not only over `modern.config.ts`, but also the `modernConfig` field in `package.json`.
|
133
|
+
- As `modern.config.local.ts` is only used for local debugging, it is not recommended to commit it to the repository, please ensure that the project's `.gitignore` file contains `modern.config.local.ts`.
|
134
|
+
|
135
|
+
```bash title=".gitingore"
|
136
|
+
modern.config.local.ts
|
137
|
+
modern.config.local.js
|
138
|
+
modern.config.local.mjs
|
139
|
+
```
|
@@ -4,9 +4,9 @@ sidebar_position: 2
|
|
4
4
|
---
|
5
5
|
# Builder
|
6
6
|
|
7
|
-
**Modern.js uses [Modern.js Builder](https://modernjs.dev/builder) to build your Web
|
7
|
+
**Modern.js uses [Modern.js Builder](https://modernjs.dev/builder) to build your Web App.**
|
8
8
|
|
9
|
-
Modern.js Builder is one of the core components of Modern.js. It is a build engine for
|
9
|
+
Modern.js Builder is one of the core components of Modern.js. It is a build engine for Web development and can be used independently of Modern.js. Modern.js Builder supports multiple bundlers such as webpack and rspack, and it uses webpack by default.
|
10
10
|
|
11
11
|
## Build Architecture
|
12
12
|
|
@@ -14,7 +14,7 @@ From the perspective of building, Modern.js is divided into three layers, from t
|
|
14
14
|
|
15
15
|
- Upper-layer framework: Modern.js.
|
16
16
|
- Universal build engine: Modern.js Builder.
|
17
|
-
- Low-level bundlers: webpack and
|
17
|
+
- Low-level bundlers: webpack and Rspack.
|
18
18
|
|
19
19
|
<img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ maxWidth: '540px' }} />
|
20
20
|
|
@@ -53,36 +53,36 @@ In the custom type of the generator plugin to create a project scenario, only th
|
|
53
53
|
|
54
54
|
### noNeedInstall
|
55
55
|
|
56
|
-
- Type
|
57
|
-
- Default
|
56
|
+
- **Type:** `boolean`
|
57
|
+
- **Default:** `false`
|
58
58
|
|
59
59
|
Whether to skip the dependency installation.
|
60
60
|
|
61
61
|
### noNeedGit
|
62
62
|
|
63
|
-
- Type
|
64
|
-
- Default
|
63
|
+
- **Type:** `boolean`
|
64
|
+
- **Default:** `false`
|
65
65
|
|
66
66
|
Whether to skip git initialization and commit initial commit.
|
67
67
|
|
68
68
|
### successInfo
|
69
69
|
|
70
|
-
- Type
|
71
|
-
- Default
|
70
|
+
- **Type:** `string`
|
71
|
+
- **Default:** Command operation prompts for different project schemes.
|
72
72
|
|
73
73
|
Customize prompt information to create project success.
|
74
74
|
|
75
75
|
### isMonorepoSubProject
|
76
76
|
|
77
|
-
- Type
|
78
|
-
- Default
|
77
|
+
- **Type:** `boolean`
|
78
|
+
- **Default:** `false`
|
79
79
|
|
80
80
|
Whether it is a Monorepo subproject.
|
81
81
|
|
82
82
|
### isTest
|
83
83
|
|
84
|
-
- Type
|
85
|
-
- Default
|
84
|
+
- **Type:** `boolean`
|
85
|
+
- **Default:** `false`
|
86
86
|
|
87
87
|
Works on an Application project to identify whether it is a test project.
|
88
88
|
|
@@ -91,8 +91,8 @@ Works on an Application project to identify whether it is a test project.
|
|
91
91
|
|
92
92
|
### isPublic
|
93
93
|
|
94
|
-
- Type
|
95
|
-
- Default
|
94
|
+
- **Type:** `boolean`
|
95
|
+
- **Default:** `false`
|
96
96
|
|
97
97
|
Used in the Module project to identify whether it needs to be published to npm.
|
98
98
|
|
package/package.json
CHANGED
@@ -11,13 +11,13 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.3.0",
|
15
15
|
"publishConfig": {
|
16
16
|
"registry": "https://registry.npmjs.org/",
|
17
17
|
"access": "public"
|
18
18
|
},
|
19
19
|
"peerDependencies": {
|
20
|
-
"@modern-js/builder-doc": "^2.
|
20
|
+
"@modern-js/builder-doc": "^2.3.0"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"ts-node": "^10",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"fs-extra": "^10",
|
26
26
|
"@types/node": "^16",
|
27
27
|
"@types/fs-extra": "^9",
|
28
|
-
"@modern-js/builder-doc": "2.
|
28
|
+
"@modern-js/builder-doc": "2.3.0"
|
29
29
|
},
|
30
30
|
"scripts": {
|
31
31
|
"build": "npx ts-node ./scripts/sync.ts"
|
package/scripts/config.ts
CHANGED
@@ -2,8 +2,8 @@ import path from 'path';
|
|
2
2
|
import fs from 'fs-extra';
|
3
3
|
|
4
4
|
const tip: Record<string, string> = {
|
5
|
-
zh: '
|
6
|
-
en: 'This
|
5
|
+
zh: '该配置由 Modern.js Builder 提供,更多信息可参考',
|
6
|
+
en: 'This config is provided by Modern.js Builder, more detail can see',
|
7
7
|
};
|
8
8
|
|
9
9
|
export type Summary = {
|
@@ -19,11 +19,12 @@ const createMarkdown = (summary: Summary, lng: Language) => {
|
|
19
19
|
const langPrefix = lng === 'zh' ? '' : `/${lng}`;
|
20
20
|
|
21
21
|
return `---
|
22
|
-
title: ${dirname}.${name}
|
23
22
|
sidebar_label: ${name}
|
24
23
|
---
|
25
24
|
|
26
|
-
|
25
|
+
# ${dirname}.${name}
|
26
|
+
|
27
|
+
:::tip
|
27
28
|
${
|
28
29
|
tip[lng]
|
29
30
|
} [${dirname}.${name}](https://modernjs.dev/builder${langPrefix}/api/config-${dirname}.html#${dirname}-${name.toLowerCase()})。
|
package/scripts/summary.en.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[{"name":"assetPrefix","dirname":"dev"},{"name":"hmr","dirname":"dev"},{"name":"https","dirname":"dev"},{"name":"port","dirname":"dev"},{"name":"progressBar","dirname":"dev"},{"name":"startUrl","dirname":"dev"},{"name":"lazyCompilation","dirname":"experiments"},{"name":"appIcon","dirname":"html"},{"name":"crossorigin","dirname":"html"},{"name":"disableHtmlFolder","dirname":"html"},{"name":"favicon","dirname":"html"},{"name":"faviconByEntries","dirname":"html"},{"name":"inject","dirname":"html"},{"name":"injectByEntries","dirname":"html"},{"name":"meta","dirname":"html"},{"name":"metaByEntries","dirname":"html"},{"name":"mountId","dirname":"html"},{"name":"tags","dirname":"html"},{"name":"tagsByEntries","dirname":"html"},{"name":"template","dirname":"html"},{"name":"templateByEntries","dirname":"html"},{"name":"templateParameters","dirname":"html"},{"name":"templateParametersByEntries","dirname":"html"},{"name":"title","dirname":"html"},{"name":"titleByEntries","dirname":"html"},{"name":"assetPrefix","dirname":"output"},{"name":"assetsRetry","dirname":"output"},{"name":"charset","dirname":"output"},{"name":"cleanDistPath","dirname":"output"},{"name":"convertToRem","dirname":"output"},{"name":"copy","dirname":"output"},{"name":"cssModuleLocalIdentName","dirname":"output"},{"name":"dataUriLimit","dirname":"output"},{"name":"disableCssExtract","dirname":"output"},{"name":"disableCssModuleExtension","dirname":"output"},{"name":"disableFilenameHash","dirname":"output"},{"name":"disableInlineRuntimeChunk","dirname":"output"},{"name":"disableMinimize","dirname":"output"},{"name":"disableSourceMap","dirname":"output"},{"name":"disableTsChecker","dirname":"output"},{"name":"distPath","dirname":"output"},{"name":"enableAssetFallback","dirname":"output"},{"name":"enableAssetManifest","dirname":"output"},{"name":"enableCssModuleTSDeclaration","dirname":"output"},{"name":"enableInlineScripts","dirname":"output"},{"name":"enableInlineStyles","dirname":"output"},{"name":"enableLatestDecorators","dirname":"output"},{"name":"externals","dirname":"output"},{"name":"filename","dirname":"output"},{"name":"legalComments","dirname":"output"},{"name":"overrideBrowserslist","dirname":"output"},{"name":"polyfill","dirname":"output"},{"name":"svgDefaultExport","dirname":"output"},{"name":"buildCache","dirname":"performance"},{"name":"bundleAnalyze","dirname":"performance"},{"name":"chunkSplit","dirname":"performance"},{"name":"printFileSize","dirname":"performance"},{"name":"profile","dirname":"performance"},{"name":"removeConsole","dirname":"performance"},{"name":"removeMomentLocale","dirname":"performance"},{"name":"sri","dirname":"security"},{"name":"alias","dirname":"source"},{"name":"compileJsDataURI","dirname":"source"},{"name":"define","dirname":"source"},{"name":"exclude","dirname":"source"},{"name":"globalVars","dirname":"source"},{"name":"include","dirname":"source"},{"name":"moduleScopes","dirname":"source"},{"name":"preEntry","dirname":"source"},{"name":"resolveExtensionPrefix","dirname":"source"},{"name":"resolveMainFields","dirname":"source"},{"name":"autoprefixer","dirname":"tools"},{"name":"babel","dirname":"tools"},{"name":"cssExtract","dirname":"tools"},{"name":"cssLoader","dirname":"tools"},{"name":"devServer","dirname":"tools"},{"name":"htmlPlugin","dirname":"tools"},{"name":"inspector","dirname":"tools"},{"name":"less","dirname":"tools"},{"name":"minifyCss","dirname":"tools"},{"name":"postcss","dirname":"tools"},{"name":"pug","dirname":"tools"},{"name":"sass","dirname":"tools"},{"name":"styleLoader","dirname":"tools"},{"name":"styledComponents","dirname":"tools"},{"name":"terser","dirname":"tools"},{"name":"tsChecker","dirname":"tools"},{"name":"tsLoader","dirname":"tools"},{"name":"webpack","dirname":"tools"},{"name":"webpackChain","dirname":"tools"}]
|
1
|
+
[{"name":"assetPrefix","dirname":"dev"},{"name":"hmr","dirname":"dev"},{"name":"https","dirname":"dev"},{"name":"port","dirname":"dev"},{"name":"progressBar","dirname":"dev"},{"name":"startUrl","dirname":"dev"},{"name":"lazyCompilation","dirname":"experiments"},{"name":"appIcon","dirname":"html"},{"name":"crossorigin","dirname":"html"},{"name":"disableHtmlFolder","dirname":"html"},{"name":"favicon","dirname":"html"},{"name":"faviconByEntries","dirname":"html"},{"name":"inject","dirname":"html"},{"name":"injectByEntries","dirname":"html"},{"name":"meta","dirname":"html"},{"name":"metaByEntries","dirname":"html"},{"name":"mountId","dirname":"html"},{"name":"tags","dirname":"html"},{"name":"tagsByEntries","dirname":"html"},{"name":"template","dirname":"html"},{"name":"templateByEntries","dirname":"html"},{"name":"templateParameters","dirname":"html"},{"name":"templateParametersByEntries","dirname":"html"},{"name":"title","dirname":"html"},{"name":"titleByEntries","dirname":"html"},{"name":"assetPrefix","dirname":"output"},{"name":"assetsRetry","dirname":"output"},{"name":"charset","dirname":"output"},{"name":"cleanDistPath","dirname":"output"},{"name":"convertToRem","dirname":"output"},{"name":"copy","dirname":"output"},{"name":"cssModuleLocalIdentName","dirname":"output"},{"name":"dataUriLimit","dirname":"output"},{"name":"disableCssExtract","dirname":"output"},{"name":"disableCssModuleExtension","dirname":"output"},{"name":"disableFilenameHash","dirname":"output"},{"name":"disableInlineRuntimeChunk","dirname":"output"},{"name":"disableMinimize","dirname":"output"},{"name":"disableSourceMap","dirname":"output"},{"name":"disableTsChecker","dirname":"output"},{"name":"distPath","dirname":"output"},{"name":"enableAssetFallback","dirname":"output"},{"name":"enableAssetManifest","dirname":"output"},{"name":"enableCssModuleTSDeclaration","dirname":"output"},{"name":"enableInlineScripts","dirname":"output"},{"name":"enableInlineStyles","dirname":"output"},{"name":"enableLatestDecorators","dirname":"output"},{"name":"externals","dirname":"output"},{"name":"filename","dirname":"output"},{"name":"legalComments","dirname":"output"},{"name":"overrideBrowserslist","dirname":"output"},{"name":"polyfill","dirname":"output"},{"name":"svgDefaultExport","dirname":"output"},{"name":"buildCache","dirname":"performance"},{"name":"bundleAnalyze","dirname":"performance"},{"name":"chunkSplit","dirname":"performance"},{"name":"printFileSize","dirname":"performance"},{"name":"profile","dirname":"performance"},{"name":"removeConsole","dirname":"performance"},{"name":"removeMomentLocale","dirname":"performance"},{"name":"checkSyntax","dirname":"security"},{"name":"sri","dirname":"security"},{"name":"alias","dirname":"source"},{"name":"compileJsDataURI","dirname":"source"},{"name":"define","dirname":"source"},{"name":"exclude","dirname":"source"},{"name":"globalVars","dirname":"source"},{"name":"include","dirname":"source"},{"name":"moduleScopes","dirname":"source"},{"name":"preEntry","dirname":"source"},{"name":"resolveExtensionPrefix","dirname":"source"},{"name":"resolveMainFields","dirname":"source"},{"name":"autoprefixer","dirname":"tools"},{"name":"babel","dirname":"tools"},{"name":"cssExtract","dirname":"tools"},{"name":"cssLoader","dirname":"tools"},{"name":"devServer","dirname":"tools"},{"name":"htmlPlugin","dirname":"tools"},{"name":"inspector","dirname":"tools"},{"name":"less","dirname":"tools"},{"name":"minifyCss","dirname":"tools"},{"name":"postcss","dirname":"tools"},{"name":"pug","dirname":"tools"},{"name":"sass","dirname":"tools"},{"name":"styleLoader","dirname":"tools"},{"name":"styledComponents","dirname":"tools"},{"name":"terser","dirname":"tools"},{"name":"tsChecker","dirname":"tools"},{"name":"tsLoader","dirname":"tools"},{"name":"webpack","dirname":"tools"},{"name":"webpackChain","dirname":"tools"}]
|
package/scripts/summary.zh.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[{"name":"assetPrefix","dirname":"dev"},{"name":"hmr","dirname":"dev"},{"name":"https","dirname":"dev"},{"name":"port","dirname":"dev"},{"name":"progressBar","dirname":"dev"},{"name":"startUrl","dirname":"dev"},{"name":"lazyCompilation","dirname":"experiments"},{"name":"appIcon","dirname":"html"},{"name":"crossorigin","dirname":"html"},{"name":"disableHtmlFolder","dirname":"html"},{"name":"favicon","dirname":"html"},{"name":"faviconByEntries","dirname":"html"},{"name":"inject","dirname":"html"},{"name":"injectByEntries","dirname":"html"},{"name":"meta","dirname":"html"},{"name":"metaByEntries","dirname":"html"},{"name":"mountId","dirname":"html"},{"name":"tags","dirname":"html"},{"name":"tagsByEntries","dirname":"html"},{"name":"template","dirname":"html"},{"name":"templateByEntries","dirname":"html"},{"name":"templateParameters","dirname":"html"},{"name":"templateParametersByEntries","dirname":"html"},{"name":"title","dirname":"html"},{"name":"titleByEntries","dirname":"html"},{"name":"assetPrefix","dirname":"output"},{"name":"assetsRetry","dirname":"output"},{"name":"charset","dirname":"output"},{"name":"cleanDistPath","dirname":"output"},{"name":"convertToRem","dirname":"output"},{"name":"copy","dirname":"output"},{"name":"cssModuleLocalIdentName","dirname":"output"},{"name":"dataUriLimit","dirname":"output"},{"name":"disableCssExtract","dirname":"output"},{"name":"disableCssModuleExtension","dirname":"output"},{"name":"disableFilenameHash","dirname":"output"},{"name":"disableInlineRuntimeChunk","dirname":"output"},{"name":"disableMinimize","dirname":"output"},{"name":"disableSourceMap","dirname":"output"},{"name":"disableTsChecker","dirname":"output"},{"name":"distPath","dirname":"output"},{"name":"enableAssetFallback","dirname":"output"},{"name":"enableAssetManifest","dirname":"output"},{"name":"enableCssModuleTSDeclaration","dirname":"output"},{"name":"enableInlineScripts","dirname":"output"},{"name":"enableInlineStyles","dirname":"output"},{"name":"enableLatestDecorators","dirname":"output"},{"name":"externals","dirname":"output"},{"name":"filename","dirname":"output"},{"name":"legalComments","dirname":"output"},{"name":"overrideBrowserslist","dirname":"output"},{"name":"polyfill","dirname":"output"},{"name":"svgDefaultExport","dirname":"output"},{"name":"buildCache","dirname":"performance"},{"name":"bundleAnalyze","dirname":"performance"},{"name":"chunkSplit","dirname":"performance"},{"name":"printFileSize","dirname":"performance"},{"name":"profile","dirname":"performance"},{"name":"removeConsole","dirname":"performance"},{"name":"removeMomentLocale","dirname":"performance"},{"name":"sri","dirname":"security"},{"name":"alias","dirname":"source"},{"name":"compileJsDataURI","dirname":"source"},{"name":"define","dirname":"source"},{"name":"exclude","dirname":"source"},{"name":"globalVars","dirname":"source"},{"name":"include","dirname":"source"},{"name":"moduleScopes","dirname":"source"},{"name":"preEntry","dirname":"source"},{"name":"resolveExtensionPrefix","dirname":"source"},{"name":"resolveMainFields","dirname":"source"},{"name":"autoprefixer","dirname":"tools"},{"name":"babel","dirname":"tools"},{"name":"cssExtract","dirname":"tools"},{"name":"cssLoader","dirname":"tools"},{"name":"devServer","dirname":"tools"},{"name":"htmlPlugin","dirname":"tools"},{"name":"inspector","dirname":"tools"},{"name":"less","dirname":"tools"},{"name":"minifyCss","dirname":"tools"},{"name":"postcss","dirname":"tools"},{"name":"pug","dirname":"tools"},{"name":"sass","dirname":"tools"},{"name":"styleLoader","dirname":"tools"},{"name":"styledComponents","dirname":"tools"},{"name":"terser","dirname":"tools"},{"name":"tsChecker","dirname":"tools"},{"name":"tsLoader","dirname":"tools"},{"name":"webpack","dirname":"tools"},{"name":"webpackChain","dirname":"tools"}]
|
1
|
+
[{"name":"assetPrefix","dirname":"dev"},{"name":"hmr","dirname":"dev"},{"name":"https","dirname":"dev"},{"name":"port","dirname":"dev"},{"name":"progressBar","dirname":"dev"},{"name":"startUrl","dirname":"dev"},{"name":"lazyCompilation","dirname":"experiments"},{"name":"appIcon","dirname":"html"},{"name":"crossorigin","dirname":"html"},{"name":"disableHtmlFolder","dirname":"html"},{"name":"favicon","dirname":"html"},{"name":"faviconByEntries","dirname":"html"},{"name":"inject","dirname":"html"},{"name":"injectByEntries","dirname":"html"},{"name":"meta","dirname":"html"},{"name":"metaByEntries","dirname":"html"},{"name":"mountId","dirname":"html"},{"name":"tags","dirname":"html"},{"name":"tagsByEntries","dirname":"html"},{"name":"template","dirname":"html"},{"name":"templateByEntries","dirname":"html"},{"name":"templateParameters","dirname":"html"},{"name":"templateParametersByEntries","dirname":"html"},{"name":"title","dirname":"html"},{"name":"titleByEntries","dirname":"html"},{"name":"assetPrefix","dirname":"output"},{"name":"assetsRetry","dirname":"output"},{"name":"charset","dirname":"output"},{"name":"cleanDistPath","dirname":"output"},{"name":"convertToRem","dirname":"output"},{"name":"copy","dirname":"output"},{"name":"cssModuleLocalIdentName","dirname":"output"},{"name":"dataUriLimit","dirname":"output"},{"name":"disableCssExtract","dirname":"output"},{"name":"disableCssModuleExtension","dirname":"output"},{"name":"disableFilenameHash","dirname":"output"},{"name":"disableInlineRuntimeChunk","dirname":"output"},{"name":"disableMinimize","dirname":"output"},{"name":"disableSourceMap","dirname":"output"},{"name":"disableTsChecker","dirname":"output"},{"name":"distPath","dirname":"output"},{"name":"enableAssetFallback","dirname":"output"},{"name":"enableAssetManifest","dirname":"output"},{"name":"enableCssModuleTSDeclaration","dirname":"output"},{"name":"enableInlineScripts","dirname":"output"},{"name":"enableInlineStyles","dirname":"output"},{"name":"enableLatestDecorators","dirname":"output"},{"name":"externals","dirname":"output"},{"name":"filename","dirname":"output"},{"name":"legalComments","dirname":"output"},{"name":"overrideBrowserslist","dirname":"output"},{"name":"polyfill","dirname":"output"},{"name":"svgDefaultExport","dirname":"output"},{"name":"buildCache","dirname":"performance"},{"name":"bundleAnalyze","dirname":"performance"},{"name":"chunkSplit","dirname":"performance"},{"name":"printFileSize","dirname":"performance"},{"name":"profile","dirname":"performance"},{"name":"removeConsole","dirname":"performance"},{"name":"removeMomentLocale","dirname":"performance"},{"name":"checkSyntax","dirname":"security"},{"name":"sri","dirname":"security"},{"name":"alias","dirname":"source"},{"name":"compileJsDataURI","dirname":"source"},{"name":"define","dirname":"source"},{"name":"exclude","dirname":"source"},{"name":"globalVars","dirname":"source"},{"name":"include","dirname":"source"},{"name":"moduleScopes","dirname":"source"},{"name":"preEntry","dirname":"source"},{"name":"resolveExtensionPrefix","dirname":"source"},{"name":"resolveMainFields","dirname":"source"},{"name":"autoprefixer","dirname":"tools"},{"name":"babel","dirname":"tools"},{"name":"cssExtract","dirname":"tools"},{"name":"cssLoader","dirname":"tools"},{"name":"devServer","dirname":"tools"},{"name":"htmlPlugin","dirname":"tools"},{"name":"inspector","dirname":"tools"},{"name":"less","dirname":"tools"},{"name":"minifyCss","dirname":"tools"},{"name":"postcss","dirname":"tools"},{"name":"pug","dirname":"tools"},{"name":"sass","dirname":"tools"},{"name":"styleLoader","dirname":"tools"},{"name":"styledComponents","dirname":"tools"},{"name":"terser","dirname":"tools"},{"name":"tsChecker","dirname":"tools"},{"name":"tsLoader","dirname":"tools"},{"name":"webpack","dirname":"tools"},{"name":"webpackChain","dirname":"tools"}]
|
@@ -6,7 +6,7 @@ sidebar_position: 1
|
|
6
6
|
|
7
7
|
在 BFF 函数写法下,声明 API 路由的文件。除了[某些约定文件](/apis/app/hooks/api/functions/api)外,`api` 目录下的文件会被注册为接口的路由。
|
8
8
|
|
9
|
-
:::info
|
9
|
+
:::info
|
10
10
|
使用 `api` 目录需要开启 BFF 功能,需要在项目下执行 new 命令启用「BFF」功能。
|
11
11
|
|
12
12
|
该文件支持使用 `js` 或 `ts` 语言,但必须使用 `esm` 语法导出函数。
|
@@ -74,7 +74,7 @@ export const get = async () => {
|
|
74
74
|
|
75
75
|
可以在一个文件中定义多个不同 Method 的函数,但如果定义多个相同 Method 的函数,则只有第一个会生效。
|
76
76
|
|
77
|
-
:::info
|
77
|
+
:::info
|
78
78
|
需要注意的是,定义的函数都应该是异步的,这个与函数调用时类型有关,这个后面会提到。
|
79
79
|
|
80
80
|
:::
|
@@ -14,7 +14,7 @@ Options:
|
|
14
14
|
-h, --help display help for command
|
15
15
|
```
|
16
16
|
|
17
|
-
:::info
|
17
|
+
:::info
|
18
18
|
[`change`](/apis/monorepo/commands/change)、[`pre`](/apis/monorepo/commands/pre)、[`bump`](/apis/monorepo/commands/bump)、[`release`](/apis/monorepo/commands/release) 命令集成了工具 [`changesets`](https://github.com/atlassian/changesets) 管理版本变更和 Changelog。
|
19
19
|
|
20
20
|
:::
|
@@ -1,5 +1,5 @@
|
|
1
|
-
-
|
2
|
-
-
|
1
|
+
- **类型:** `string | Object`
|
2
|
+
- **默认值:** `null`
|
3
3
|
|
4
4
|
配置该选项后,开发环境时会启动全局代理,类似 [Fiddler](https://www.telerik.com/fiddler), [Charles](https://www.charlesproxy.com/) 等 web 代理调试工具,可以用来查看、修改 HTTP/HTTPS 请求、响应、也可以用作代理服务器。
|
5
5
|
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
43
43
|
};
|
44
44
|
```
|
45
45
|
|
46
|
-
:::info
|
46
|
+
:::info
|
47
47
|
Modern.js 全局代理实现底层基于 [whistle](https://wproxy.org/whistle/), 更多匹配模式请参考: [匹配模式](https://wproxy.org/whistle/pattern.html)
|
48
48
|
|
49
49
|
:::
|
@@ -4,8 +4,8 @@ sidebar_label: proxy
|
|
4
4
|
|
5
5
|
# bff.proxy
|
6
6
|
|
7
|
-
-
|
8
|
-
-
|
7
|
+
- **类型:** `Record<string, string>`
|
8
|
+
- **默认值:** `{}`
|
9
9
|
|
10
10
|
:::info 补充信息
|
11
11
|
请先在当前应用项目根目录使用【[new](/apis/app/commands/new)】 启用 BFF 功能。
|
@@ -56,7 +56,7 @@ export default defineConfig({
|
|
56
56
|
在项目开发过程中,因为 web 页面和接口服务不是部署在同一个域名下,常常会遇到跨域问题。
|
57
57
|
解决跨域问题的方式有很多,在这里我们使用 `bff.proxy` 可以轻松解决跨域问题。
|
58
58
|
|
59
|
-
:::info
|
59
|
+
:::info
|
60
60
|
BFF proxy 模式下,如果不需要写 BFF 的接口, API 目录可以删除;此时 BFF proxy 仍会开启。
|
61
61
|
|
62
62
|
:::
|