@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.98 → 3.8.1-ultramodern.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modern-bundle-docs.js +7 -0
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +5 -1
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +80 -11
- package/dist/cjs/bundleDocs.js +114 -0
- package/dist/cjs/commands/build.js +2 -1
- package/dist/cjs/commands/deploy.js +4 -2
- package/dist/cjs/commands/index.js +0 -4
- package/dist/cjs/config/default.js +2 -0
- package/dist/cjs/index.js +56 -15
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +3 -2
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +1 -1
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +94 -18
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/cjs/plugins/initialize/index.js +4 -3
- package/dist/cjs/plugins/serverBuild.js +3 -2
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +109 -57
- package/dist/esm/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +70 -10
- package/dist/esm/bundleDocs.mjs +62 -0
- package/dist/esm/commands/build.mjs +2 -1
- package/dist/esm/commands/deploy.mjs +4 -2
- package/dist/esm/commands/index.mjs +0 -4
- package/dist/esm/config/default.mjs +2 -0
- package/dist/esm/index.mjs +15 -1
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +3 -2
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm/plugins/initialize/index.mjs +4 -3
- package/dist/esm/plugins/serverBuild.mjs +3 -2
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +70 -10
- package/dist/esm-node/bundleDocs.mjs +63 -0
- package/dist/esm-node/commands/build.mjs +2 -1
- package/dist/esm-node/commands/deploy.mjs +4 -2
- package/dist/esm-node/commands/index.mjs +0 -4
- package/dist/esm-node/config/default.mjs +2 -0
- package/dist/esm-node/index.mjs +15 -1
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +3 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm-node/plugins/initialize/index.mjs +4 -3
- package/dist/esm-node/plugins/serverBuild.mjs +3 -2
- package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +29 -0
- package/dist/types/bundleDocs.d.ts +20 -0
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +13 -0
- package/dist/types/types/config/dev.d.ts +6 -0
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +1 -0
- package/docs/apis/app/commands.md +231 -0
- package/docs/apis/app/hooks/api/lambda.md +9 -0
- package/docs/apis/app/hooks/config/favicon.md +24 -0
- package/docs/apis/app/hooks/config/html.md +5 -0
- package/docs/apis/app/hooks/config/icon.md +24 -0
- package/docs/apis/app/hooks/config/mock.md +6 -0
- package/docs/apis/app/hooks/config/public.md +26 -0
- package/docs/apis/app/hooks/config/upload.md +50 -0
- package/docs/apis/app/hooks/modern-config.md +5 -0
- package/docs/apis/app/hooks/server/server.md +5 -0
- package/docs/apis/app/hooks/shared.md +3 -0
- package/docs/apis/app/hooks/src/app.md +30 -0
- package/docs/apis/app/hooks/src/entry.md +34 -0
- package/docs/apis/app/hooks/src/entry.server.md +51 -0
- package/docs/apis/app/hooks/src/modern.runtime.md +5 -0
- package/docs/apis/app/hooks/src/routes.md +86 -0
- package/docs/apis/app/hooks/src/server.md +3 -0
- package/docs/apis/app/runtime/bff/use-backend-context.md +27 -0
- package/docs/apis/app/runtime/core/create-root.md +19 -0
- package/docs/apis/app/runtime/core/render.md +39 -0
- package/docs/apis/app/runtime/core/runtime-context.md +156 -0
- package/docs/apis/app/runtime/router/router.md +283 -0
- package/docs/apis/app/runtime/ssr/no-ssr.md +35 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.md +67 -0
- package/docs/apis/app/runtime/ssr/renderString.md +60 -0
- package/docs/apis/app/runtime/ssr/requestHandler.md +44 -0
- package/docs/apis/app/runtime/utility/css-in-js.md +40 -0
- package/docs/apis/app/runtime/utility/head.md +35 -0
- package/docs/apis/app/runtime/utility/loadable.md +82 -0
- package/docs/community/blog/2022-0708-updates.md +91 -0
- package/docs/community/blog/2022-0910-updates.md +76 -0
- package/docs/community/blog/overview.md +63 -0
- package/docs/community/blog/v2-release-note.md +238 -0
- package/docs/community/blog/v3-release-note.md +622 -0
- package/docs/community/contributing-guide.md +252 -0
- package/docs/community/releases.md +23 -0
- package/docs/community/showcase.md +24 -0
- package/docs/community/team.md +14 -0
- package/docs/configure/app/bff/cross-project.md +20 -0
- package/docs/configure/app/bff/effect.md +313 -0
- package/docs/configure/app/bff/prefix.md +29 -0
- package/docs/configure/app/bff/runtime-framework.md +26 -0
- package/docs/configure/app/builder-plugins.md +66 -0
- package/docs/configure/app/dev/asset-prefix.md +13 -0
- package/docs/configure/app/dev/before-start-url.md +17 -0
- package/docs/configure/app/dev/client.md +41 -0
- package/docs/configure/app/dev/hmr.md +10 -0
- package/docs/configure/app/dev/host.md +18 -0
- package/docs/configure/app/dev/https.md +77 -0
- package/docs/configure/app/dev/lazy-compilation.md +39 -0
- package/docs/configure/app/dev/live-reload.md +10 -0
- package/docs/configure/app/dev/mock-dir.md +31 -0
- package/docs/configure/app/dev/progress-bar.md +19 -0
- package/docs/configure/app/dev/server.md +124 -0
- package/docs/configure/app/dev/setup-middlewares.md +32 -0
- package/docs/configure/app/dev/start-url.md +48 -0
- package/docs/configure/app/dev/watch-files.md +27 -0
- package/docs/configure/app/dev/write-to-disk.md +10 -0
- package/docs/configure/app/experiments/source-build.md +31 -0
- package/docs/configure/app/html/app-icon.md +28 -0
- package/docs/configure/app/html/crossorigin.md +10 -0
- package/docs/configure/app/html/favicon.md +16 -0
- package/docs/configure/app/html/inject.md +10 -0
- package/docs/configure/app/html/meta.md +24 -0
- package/docs/configure/app/html/mount-id.md +10 -0
- package/docs/configure/app/html/output-structure.md +10 -0
- package/docs/configure/app/html/script-loading.md +10 -0
- package/docs/configure/app/html/tags.md +15 -0
- package/docs/configure/app/html/template-parameters.md +33 -0
- package/docs/configure/app/html/template.md +10 -0
- package/docs/configure/app/html/title.md +18 -0
- package/docs/configure/app/output/asset-prefix.md +11 -0
- package/docs/configure/app/output/assets-retry.md +77 -0
- package/docs/configure/app/output/charset.md +10 -0
- package/docs/configure/app/output/clean-dist-path.md +16 -0
- package/docs/configure/app/output/convert-to-rem.md +79 -0
- package/docs/configure/app/output/copy.md +10 -0
- package/docs/configure/app/output/css-modules.md +48 -0
- package/docs/configure/app/output/data-uri-limit.md +26 -0
- package/docs/configure/app/output/disable-css-module-extension.md +55 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.md +41 -0
- package/docs/configure/app/output/disable-svgr.md +18 -0
- package/docs/configure/app/output/disable-ts-checker.md +49 -0
- package/docs/configure/app/output/dist-path.md +43 -0
- package/docs/configure/app/output/enable-asset-manifest.md +36 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.md +28 -0
- package/docs/configure/app/output/enable-inline-route-manifests.md +16 -0
- package/docs/configure/app/output/externals.md +20 -0
- package/docs/configure/app/output/filename-hash.md +10 -0
- package/docs/configure/app/output/filename.md +55 -0
- package/docs/configure/app/output/inject-styles.md +10 -0
- package/docs/configure/app/output/inline-scripts.md +29 -0
- package/docs/configure/app/output/inline-styles.md +29 -0
- package/docs/configure/app/output/legal-comments.md +18 -0
- package/docs/configure/app/output/minify.md +22 -0
- package/docs/configure/app/output/override-browserslist.md +22 -0
- package/docs/configure/app/output/polyfill.md +12 -0
- package/docs/configure/app/output/source-map.md +30 -0
- package/docs/configure/app/output/split-route-chunks.md +16 -0
- package/docs/configure/app/output/ssg.md +81 -0
- package/docs/configure/app/output/ssgByEntries.md +90 -0
- package/docs/configure/app/output/svg-default-export.md +30 -0
- package/docs/configure/app/output/temp-dir.md +20 -0
- package/docs/configure/app/performance/build-cache.md +44 -0
- package/docs/configure/app/performance/chunk-split.md +40 -0
- package/docs/configure/app/performance/dns-prefetch.md +15 -0
- package/docs/configure/app/performance/preconnect.md +16 -0
- package/docs/configure/app/performance/prefetch.md +21 -0
- package/docs/configure/app/performance/preload.md +23 -0
- package/docs/configure/app/performance/print-file-size.md +40 -0
- package/docs/configure/app/performance/profile.md +10 -0
- package/docs/configure/app/performance/remove-console.md +10 -0
- package/docs/configure/app/performance/remove-moment-locale.md +10 -0
- package/docs/configure/app/performance/rsdoctor.md +38 -0
- package/docs/configure/app/plugins.md +59 -0
- package/docs/configure/app/resolve/alias-strategy.md +10 -0
- package/docs/configure/app/resolve/alias.md +9 -0
- package/docs/configure/app/resolve/condition-names.md +13 -0
- package/docs/configure/app/resolve/dedupe.md +9 -0
- package/docs/configure/app/resolve/extensions.md +13 -0
- package/docs/configure/app/runtime/0-intro.md +58 -0
- package/docs/configure/app/runtime/plugins.md +58 -0
- package/docs/configure/app/runtime/router.md +35 -0
- package/docs/configure/app/security/check-syntax.md +69 -0
- package/docs/configure/app/security/nonce.md +15 -0
- package/docs/configure/app/security/sri.md +20 -0
- package/docs/configure/app/server/base-url.md +26 -0
- package/docs/configure/app/server/port.md +18 -0
- package/docs/configure/app/server/public-routes.md +22 -0
- package/docs/configure/app/server/routes.md +86 -0
- package/docs/configure/app/server/rsc.md +22 -0
- package/docs/configure/app/server/ssr-by-entries.md +25 -0
- package/docs/configure/app/server/ssr.md +80 -0
- package/docs/configure/app/server/tsconfig-path.md +59 -0
- package/docs/configure/app/source/alias-strategy.md +14 -0
- package/docs/configure/app/source/alias.md +23 -0
- package/docs/configure/app/source/config-dir.md +20 -0
- package/docs/configure/app/source/decorators.md +25 -0
- package/docs/configure/app/source/define.md +16 -0
- package/docs/configure/app/source/disable-default-entries.md +28 -0
- package/docs/configure/app/source/enable-async-entry.md +54 -0
- package/docs/configure/app/source/enable-async-pre-entry.md +26 -0
- package/docs/configure/app/source/entries-dir.md +35 -0
- package/docs/configure/app/source/entries.md +179 -0
- package/docs/configure/app/source/exclude.md +10 -0
- package/docs/configure/app/source/global-vars.md +106 -0
- package/docs/configure/app/source/include.md +36 -0
- package/docs/configure/app/source/main-entry-name.md +24 -0
- package/docs/configure/app/source/pre-entry.md +10 -0
- package/docs/configure/app/source/react-compiler.md +68 -0
- package/docs/configure/app/source/transform-import.md +27 -0
- package/docs/configure/app/split-chunks.md +17 -0
- package/docs/configure/app/tools/autoprefixer.md +44 -0
- package/docs/configure/app/tools/bundler-chain.md +26 -0
- package/docs/configure/app/tools/css-extract.md +33 -0
- package/docs/configure/app/tools/css-loader.md +17 -0
- package/docs/configure/app/tools/dev-server.md +113 -0
- package/docs/configure/app/tools/html-plugin.md +41 -0
- package/docs/configure/app/tools/less.md +81 -0
- package/docs/configure/app/tools/lightningcss-loader.md +35 -0
- package/docs/configure/app/tools/minify-css.md +53 -0
- package/docs/configure/app/tools/postcss.md +34 -0
- package/docs/configure/app/tools/rspack.md +10 -0
- package/docs/configure/app/tools/sass.md +78 -0
- package/docs/configure/app/tools/style-loader.md +10 -0
- package/docs/configure/app/tools/swc.md +65 -0
- package/docs/configure/app/tools/ts-checker.md +116 -0
- package/docs/configure/app/usage.md +276 -0
- package/docs/guides/advanced-features/bff/cross-project.md +109 -0
- package/docs/guides/advanced-features/bff/data-platform.md +116 -0
- package/docs/guides/advanced-features/bff/extend-server.md +120 -0
- package/docs/guides/advanced-features/bff/frameworks.md +243 -0
- package/docs/guides/advanced-features/bff/function.md +318 -0
- package/docs/guides/advanced-features/bff/operators.md +554 -0
- package/docs/guides/advanced-features/bff/sdk.md +116 -0
- package/docs/guides/advanced-features/bff/upload.md +101 -0
- package/docs/guides/advanced-features/bff.md +18 -0
- package/docs/guides/advanced-features/build-performance.md +130 -0
- package/docs/guides/advanced-features/compatibility.md +120 -0
- package/docs/guides/advanced-features/international/advanced.md +128 -0
- package/docs/guides/advanced-features/international/api.md +267 -0
- package/docs/guides/advanced-features/international/best-practices.md +286 -0
- package/docs/guides/advanced-features/international/configuration.md +228 -0
- package/docs/guides/advanced-features/international/locale-detection.md +126 -0
- package/docs/guides/advanced-features/international/quick-start.md +128 -0
- package/docs/guides/advanced-features/international/resource-loading.md +154 -0
- package/docs/guides/advanced-features/international/routing.md +173 -0
- package/docs/guides/advanced-features/international.md +27 -0
- package/docs/guides/advanced-features/low-level.md +46 -0
- package/docs/guides/advanced-features/page-performance/code-split.md +77 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.md +159 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.md +97 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.md +51 -0
- package/docs/guides/advanced-features/server-monitor/logger.md +41 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
- package/docs/guides/advanced-features/server-monitor/monitors.md +242 -0
- package/docs/guides/advanced-features/source-build.md +164 -0
- package/docs/guides/advanced-features/web-server.md +288 -0
- package/docs/guides/basic-features/alias.md +102 -0
- package/docs/guides/basic-features/css/css-in-js.md +72 -0
- package/docs/guides/basic-features/css/css-modules.md +212 -0
- package/docs/guides/basic-features/css/css.md +27 -0
- package/docs/guides/basic-features/css/tailwindcss.md +27 -0
- package/docs/guides/basic-features/data/data-cache.md +510 -0
- package/docs/guides/basic-features/data/data-fetch.md +415 -0
- package/docs/guides/basic-features/data/data-write.md +227 -0
- package/docs/guides/basic-features/debug/mock.md +109 -0
- package/docs/guides/basic-features/debug/proxy.md +21 -0
- package/docs/guides/basic-features/debug/rsdoctor.md +47 -0
- package/docs/guides/basic-features/debug/using-storybook.md +112 -0
- package/docs/guides/basic-features/deploy.md +458 -0
- package/docs/guides/basic-features/env-vars.md +177 -0
- package/docs/guides/basic-features/html.md +255 -0
- package/docs/guides/basic-features/output-files.md +141 -0
- package/docs/guides/basic-features/render/before-render.md +108 -0
- package/docs/guides/basic-features/render/overview.md +47 -0
- package/docs/guides/basic-features/render/rsc.md +516 -0
- package/docs/guides/basic-features/render/ssg.md +228 -0
- package/docs/guides/basic-features/render/ssr-cache.md +201 -0
- package/docs/guides/basic-features/render/ssr.md +321 -0
- package/docs/guides/basic-features/render/streaming-ssr.md +264 -0
- package/docs/guides/basic-features/routes/config-routes.md +426 -0
- package/docs/guides/basic-features/routes/routes.md +524 -0
- package/docs/guides/basic-features/static-assets/json-files.md +120 -0
- package/docs/guides/basic-features/static-assets/svg-assets.md +168 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.md +62 -0
- package/docs/guides/basic-features/static-assets.md +160 -0
- package/docs/guides/basic-features/testing/playwright.md +120 -0
- package/docs/guides/basic-features/testing/rstest.md +251 -0
- package/docs/guides/concept/builder.md +37 -0
- package/docs/guides/concept/entries.md +319 -0
- package/docs/guides/concept/server.md +35 -0
- package/docs/guides/get-started/ai-coding-agents.md +58 -0
- package/docs/guides/get-started/glossary.md +63 -0
- package/docs/guides/get-started/introduction.md +40 -0
- package/docs/guides/get-started/quick-start.md +269 -0
- package/docs/guides/get-started/tech-stack.md +91 -0
- package/docs/guides/get-started/ultramodern.md +440 -0
- package/docs/guides/get-started/upgrade.md +118 -0
- package/docs/guides/topic-detail/module-federation/application.md +116 -0
- package/docs/guides/topic-detail/module-federation/deploy.md +104 -0
- package/docs/guides/topic-detail/module-federation/i18n.md +670 -0
- package/docs/guides/topic-detail/module-federation/introduce.md +35 -0
- package/docs/guides/topic-detail/module-federation/ssr.md +182 -0
- package/docs/guides/topic-detail/module-federation/usage.md +219 -0
- package/docs/guides/troubleshooting/builder.md +110 -0
- package/docs/guides/troubleshooting/cli.md +35 -0
- package/docs/guides/troubleshooting/dependencies.md +119 -0
- package/docs/guides/troubleshooting/hmr.md +144 -0
- package/docs/guides/upgrade/config.md +954 -0
- package/docs/guides/upgrade/entry.md +463 -0
- package/docs/guides/upgrade/other.md +183 -0
- package/docs/guides/upgrade/overview.md +33 -0
- package/docs/guides/upgrade/tailwindcss.md +91 -0
- package/docs/guides/upgrade/web-server.md +109 -0
- package/docs/index.md +33 -0
- package/docs/llms.txt +290 -0
- package/docs/plugin/cli-plugins/api.md +573 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +152 -0
- package/docs/plugin/official/cli-plugins/plugin-bff.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +5 -0
- package/docs/plugin/official/cli-plugins.md +4 -0
- package/docs/plugin/plugin-system.md +238 -0
- package/docs/plugin/runtime-plugins/api.md +194 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +209 -0
- package/docs/plugin/server-plugins/life-cycle.md +13 -0
- package/docs/tutorials/examples/csr-auth.md +9 -0
- package/docs/tutorials/foundations/introduction.md +16 -0
- package/package.json +63 -22
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# performance.dnsPrefetch
|
|
2
|
+
|
|
3
|
+
- **Type:** `undefined | string[]`
|
|
4
|
+
|
|
5
|
+
- **Default:** `undefined`
|
|
6
|
+
|
|
7
|
+
Specifies that the user agent should preemptively perform DNS resolution for the target resource's origin, refer to [dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/dns-prefetch).
|
|
8
|
+
|
|
9
|
+
After this property is set, the domain name can be resolved before the resource is requested, reducing request latency and improving loading performance.
|
|
10
|
+
|
|
11
|
+
See [Using dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) for more details.
|
|
12
|
+
|
|
13
|
+
:::info
|
|
14
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.dnsPrefetch](https://v2.rsbuild.dev/config/performance/dns-prefetch).
|
|
15
|
+
:::
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# performance.preconnect
|
|
2
|
+
|
|
3
|
+
- **Type:** `undefined | Array<string | PreconnectOption>`
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
interface PreconnectOption {
|
|
7
|
+
href: string;
|
|
8
|
+
crossorigin?: boolean;
|
|
9
|
+
}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- **Default:** `undefined`
|
|
13
|
+
|
|
14
|
+
:::info
|
|
15
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.preconnect](https://v2.rsbuild.dev/config/performance/preconnect).
|
|
16
|
+
:::
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# performance.prefetch
|
|
2
|
+
|
|
3
|
+
- **Type:** `undefined | true | PrefetchOption`
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type IncludeType = 'async-chunks' | 'initial' | 'all-assets' | 'all-chunks';
|
|
7
|
+
|
|
8
|
+
type Filter = Array<string | RegExp> | ((filename: string) => boolean);
|
|
9
|
+
|
|
10
|
+
interface PrefetchOption {
|
|
11
|
+
type?: IncludeType;
|
|
12
|
+
include?: Filter;
|
|
13
|
+
exclude?: Filter;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **Default:** `undefined`
|
|
18
|
+
|
|
19
|
+
:::info
|
|
20
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.prefetch](https://v2.rsbuild.dev/config/performance/prefetch).
|
|
21
|
+
:::
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# performance.preload
|
|
2
|
+
|
|
3
|
+
- **Type:** `undefined | true | PreloadOption`
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type IncludeType = 'async-chunks' | 'initial' | 'all-assets' | 'all-chunks';
|
|
7
|
+
|
|
8
|
+
type Filter = Array<string | RegExp> | ((filename: string) => boolean);
|
|
9
|
+
|
|
10
|
+
interface PreloadOption {
|
|
11
|
+
type?: IncludeType;
|
|
12
|
+
include?: Filter;
|
|
13
|
+
exclude?: Filter;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **Default:** `undefined`
|
|
18
|
+
|
|
19
|
+
Inject the [`<link rel="preload">`](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/rel/preload) tags for the static assets generated by Rsbuild.
|
|
20
|
+
|
|
21
|
+
:::info
|
|
22
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.preload](https://v2.rsbuild.dev/config/performance/preload).
|
|
23
|
+
:::
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# performance.printFileSize
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type PrintFileSizeOptions =
|
|
7
|
+
| {
|
|
8
|
+
/**
|
|
9
|
+
* whether to print total size
|
|
10
|
+
*/
|
|
11
|
+
total?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* whether to print size of each file
|
|
14
|
+
*/
|
|
15
|
+
detail?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* whether to print gzip-compressed size
|
|
18
|
+
*/
|
|
19
|
+
compressed?: boolean;
|
|
20
|
+
}
|
|
21
|
+
| boolean;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- **Default:** `true`
|
|
25
|
+
|
|
26
|
+
Whether to print the file sizes after production build.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
info Production file sizes:
|
|
30
|
+
|
|
31
|
+
File Size Gzipped
|
|
32
|
+
dist/static/js/lib-react.09721b5c.js 152.6 kB 49.0 kB
|
|
33
|
+
dist/html/main/index.html 5.8 kB 2.5 kB
|
|
34
|
+
dist/static/js/main.3568a38e.js 3.5 kB 1.4 kB
|
|
35
|
+
dist/static/css/main.03221f72.css 1.4 kB 741 B
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
:::info
|
|
39
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.printFileSize](https://v2.rsbuild.dev/config/performance/print-file-size).
|
|
40
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# performance.profile
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether capture timing information for each module, same as the [profile](https://rspack.rs/config/other-options#profile) config of Rspack.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.profile](https://v2.rsbuild.dev/config/performance/profile).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# performance.removeConsole
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean | ConsoleType[]`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether to remove `console.[methodName]` in production build.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.removeConsole](https://v2.rsbuild.dev/config/performance/remove-console).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# performance.removeMomentLocale
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether to remove the locales of [moment.js](https://momentjs.com/).
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.removeMomentLocale](https://v2.rsbuild.dev/config/performance/remove-moment-locale).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# performance.rsdoctor
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type RsdoctorConfig =
|
|
7
|
+
| boolean
|
|
8
|
+
| {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
disableClientServer?: boolean;
|
|
11
|
+
};
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **Default:** `undefined`, Rsdoctor is disabled unless this option is configured.
|
|
15
|
+
|
|
16
|
+
Configure Rsdoctor diagnostics in Modern.js build. Set this option to `true` to enable Rsdoctor:
|
|
17
|
+
|
|
18
|
+
```ts title="modern.config.ts"
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
performance: {
|
|
21
|
+
rsdoctor: true,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
You can also use object form. When an object is provided, Rsdoctor is enabled unless `enabled` is set to `false`:
|
|
27
|
+
|
|
28
|
+
```ts title="modern.config.ts"
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
performance: {
|
|
31
|
+
rsdoctor: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To disable Rsdoctor after enabling it in shared config, set `rsdoctor` to `false` or set `enabled` to `false`.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# plugins
|
|
2
|
+
|
|
3
|
+
- **Type:** `CliPlugin[]`
|
|
4
|
+
- **Default:** `[]`
|
|
5
|
+
|
|
6
|
+
Used to configure custom Modern.js framework CLI plugins. For information on how to create custom CLI plugins, please refer to [How to Write CLI Plugins](/plugin/introduction.md#cli-plugins).
|
|
7
|
+
|
|
8
|
+
## Note
|
|
9
|
+
|
|
10
|
+
This option is **specifically for configuring framework CLI plugins**. If you need to configure other types of plugins, use the appropriate configuration method:
|
|
11
|
+
|
|
12
|
+
- Use [builderPlugins](/configure/app/builder-plugins.md) for Rsbuild plugins.
|
|
13
|
+
- Use [tools.bundlerChain](/configure/app/tools/bundler-chain.md) for Rspack plugins.
|
|
14
|
+
- Use the [plugins field in runtime config](/configure/app/runtime/plugins.md) for framework Runtime plugins.
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
Below are examples of using CLI plugins:
|
|
19
|
+
|
|
20
|
+
### Using plugins from npm
|
|
21
|
+
|
|
22
|
+
To use plugins from the npm registry, first install the plugins and then import them in your configuration:
|
|
23
|
+
|
|
24
|
+
```ts title="modern.config.ts"
|
|
25
|
+
import { myPlugin } from 'my-plugin';
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
plugins: [myPlugin()],
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Using local plugins
|
|
33
|
+
|
|
34
|
+
To use plugins from your local repository, import them directly using a relative path:
|
|
35
|
+
|
|
36
|
+
```ts title="modern.config.ts"
|
|
37
|
+
import { myPlugin } from './config/plugin/myPlugin';
|
|
38
|
+
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
plugins: [myPlugin()],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Plugin configuration
|
|
45
|
+
|
|
46
|
+
If a plugin provides custom configuration options, pass them as parameters to the plugin function:
|
|
47
|
+
|
|
48
|
+
```ts title="modern.config.ts"
|
|
49
|
+
import { myPlugin } from 'my-plugin';
|
|
50
|
+
|
|
51
|
+
export default defineConfig({
|
|
52
|
+
plugins: [
|
|
53
|
+
myPlugin({
|
|
54
|
+
foo: 1,
|
|
55
|
+
bar: 2,
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# resolve.aliasStrategy
|
|
2
|
+
|
|
3
|
+
- **Type:** `'prefer-tsconfig' | 'prefer-alias'`
|
|
4
|
+
- **Default:** `'prefer-tsconfig'`
|
|
5
|
+
|
|
6
|
+
Set the strategy for path alias resolution, to control the priority relationship between the paths option in `tsconfig.json` and the [resolve.alias](https://v2.rsbuild.rs/config/resolve/alias) option of Rsbuild.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
该配置项的使用方式与 Rsbuild 完全一致。详细信息请参考 [Rsbuild - resolve.aliasStrategy](https://v2.rsbuild.dev/config/resolve/alias-strategy)。
|
|
10
|
+
:::
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# resolve.alias
|
|
2
|
+
|
|
3
|
+
- **Type:** `string[]`
|
|
4
|
+
|
|
5
|
+
Create aliases for module paths to simplify import paths or redirect module references.
|
|
6
|
+
|
|
7
|
+
:::info
|
|
8
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - resolve.alias](https://v2.rsbuild.dev/config/resolve/alias).
|
|
9
|
+
:::
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# resolve.conditionNames
|
|
2
|
+
|
|
3
|
+
- **Type:** `string[]`
|
|
4
|
+
- **Default:** Same as Rspack's `resolve.conditionNames`
|
|
5
|
+
|
|
6
|
+
Specifies the condition names used to match entry points in the [exports](https://nodejs.org/api/packages.html#packages_exports) of a package.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - resolve.extensions](https://v2.rsbuild.dev/config/resolve/extensions).
|
|
10
|
+
:::
|
|
11
|
+
:::warning
|
|
12
|
+
Do not enable this configuration option for SSR applications, as it will cause SSR rendering to fail.
|
|
13
|
+
:::
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# resolve.dedupe
|
|
2
|
+
|
|
3
|
+
- **Type:** `string[]`
|
|
4
|
+
|
|
5
|
+
Force Rsbuild to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size. same as the [resolve.dedupe](https://v2.rsbuild.rs/config/resolve/dedupe) config of Rsbuild.
|
|
6
|
+
|
|
7
|
+
:::info
|
|
8
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - resolve.dedupe](https://v2.rsbuild.dev/config/resolve/dedupe).
|
|
9
|
+
:::
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# resolve.extensions
|
|
2
|
+
|
|
3
|
+
- **Type:** `string[]`
|
|
4
|
+
- **Default:** `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json']`
|
|
5
|
+
|
|
6
|
+
Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - resolve.extensions](https://v2.rsbuild.dev/config/resolve/extensions).
|
|
10
|
+
:::
|
|
11
|
+
:::warning
|
|
12
|
+
Do not enable this configuration option for SSR applications, as it will cause SSR rendering to fail.
|
|
13
|
+
:::
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Introduce
|
|
2
|
+
|
|
3
|
+
Modern.js runtime configuration should be centralized in the `src/modern.runtime.ts` file.
|
|
4
|
+
|
|
5
|
+
:::info
|
|
6
|
+
|
|
7
|
+
If this file doesn't exist in your project yet, create it with the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
touch src/modern.runtime.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
:::
|
|
14
|
+
|
|
15
|
+
## Basic Configuration
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
19
|
+
|
|
20
|
+
export default defineRuntimeConfig({
|
|
21
|
+
router: {
|
|
22
|
+
// Router configuration
|
|
23
|
+
},
|
|
24
|
+
// Other runtime modules...
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Multi-Entry Configuration
|
|
29
|
+
|
|
30
|
+
For multi-entry applications, `defineRuntimeConfig` can accept a function that returns specific configurations based on the entry name:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
34
|
+
|
|
35
|
+
export default defineRuntimeConfig(entryName => {
|
|
36
|
+
if (entryName === 'main') {
|
|
37
|
+
return {
|
|
38
|
+
router: {
|
|
39
|
+
// Router configuration for "main" entry
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Configuration for other entries
|
|
45
|
+
return {
|
|
46
|
+
router: {
|
|
47
|
+
// Other entry router configuration
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
:::tip
|
|
54
|
+
|
|
55
|
+
Using the `src/modern.runtime.ts` configuration approach does not support exporting asynchronous functions, which is related to the rendering method of Modern.js. If you need to add asynchronous logic, please use the **[Runtime Plugin](/plugin/introduction.md#runtime-plugin)**.
|
|
56
|
+
|
|
57
|
+
:::
|
|
58
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# plugins
|
|
2
|
+
|
|
3
|
+
- **Type:** `RuntimePlugin[]`
|
|
4
|
+
- **Default:** `[]`
|
|
5
|
+
|
|
6
|
+
Used to configure custom Modern.js Runtime plugins. For details on how to create custom Runtime plugins, please refer to [How to Write Runtime Plugins](/plugin/introduction.md#runtime-plugins).
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
|
|
10
|
+
Runtime plugins must be configured in the `plugins` array within the `src/modern.runtime.ts` file.
|
|
11
|
+
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
Here are examples demonstrating how to use Runtime plugins:
|
|
17
|
+
|
|
18
|
+
### Using plugins from npm packages
|
|
19
|
+
|
|
20
|
+
To use plugins published on npm, first install them via your package manager, then import them into your configuration.
|
|
21
|
+
|
|
22
|
+
```ts title="src/modern.runtime.ts"
|
|
23
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
24
|
+
import { myPlugin } from 'my-plugin';
|
|
25
|
+
|
|
26
|
+
export default defineRuntimeConfig({
|
|
27
|
+
plugins: [myPlugin()],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Using local plugins
|
|
32
|
+
|
|
33
|
+
To use plugins from your local codebase, import them directly using relative paths.
|
|
34
|
+
|
|
35
|
+
```ts title="src/modern.runtime.ts"
|
|
36
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
37
|
+
import { myPlugin } from './config/plugin/myPlugin';
|
|
38
|
+
|
|
39
|
+
export default defineRuntimeConfig({
|
|
40
|
+
plugins: [myPlugin()],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Plugin configuration
|
|
45
|
+
|
|
46
|
+
If a plugin supports custom configuration options, you can provide them as arguments to the plugin function.
|
|
47
|
+
|
|
48
|
+
```ts title="src/modern.runtime.ts"
|
|
49
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
50
|
+
import { myPlugin } from './config/plugin/myPlugin';
|
|
51
|
+
|
|
52
|
+
export default defineRuntimeConfig({
|
|
53
|
+
plugins: [myPlugin({
|
|
54
|
+
foo: 1,
|
|
55
|
+
bar: 2,
|
|
56
|
+
})],
|
|
57
|
+
});
|
|
58
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# router
|
|
2
|
+
|
|
3
|
+
- **Type:** `Object`
|
|
4
|
+
- **Default:** `{}`
|
|
5
|
+
|
|
6
|
+
This configuration item is used to configure client-side routing, supporting the use of [conventional routing](/guides/concept/entries.md#convention-routing) provided by Modern.js for routing management.
|
|
7
|
+
|
|
8
|
+
:::note
|
|
9
|
+
The `router` configuration item **only takes effect when using conventional routing entries** (i.e., when there is a `routes/` directory in the entry). For controlled routing entries or custom entries, this configuration will not take effect.
|
|
10
|
+
|
|
11
|
+
In multi-entry applications, you can configure different routing behaviors for different entries using the function form of `defineRuntimeConfig`. For more details, see [Runtime Configuration Introduction](/configure/app/runtime/0-intro.md#multi-entry-configuration).
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
## basename
|
|
15
|
+
|
|
16
|
+
- **Type:** `string`
|
|
17
|
+
- **Default:** `/`
|
|
18
|
+
|
|
19
|
+
Sets the `basename` for client-side routing, typically used when the application needs to be deployed under a non-root path of the domain.
|
|
20
|
+
|
|
21
|
+
:::tip
|
|
22
|
+
It is recommended to use [`server.baseUrl`](/configure/app/server/base-url.md) for configuration.
|
|
23
|
+
:::
|
|
24
|
+
|
|
25
|
+
## supportHtml5History
|
|
26
|
+
|
|
27
|
+
- **Type:** `boolean`
|
|
28
|
+
- **Default:** `true`
|
|
29
|
+
|
|
30
|
+
If the value of `supportHtml5History` is `true`, `BrowserRouter` would be used, otherwise `HashRouter` would be used. `BrowserRouter` is recommended.
|
|
31
|
+
|
|
32
|
+
:::warning
|
|
33
|
+
When SSR is enabled, `supportHtml5History` is not supported.
|
|
34
|
+
|
|
35
|
+
:::
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# security.checkSyntax
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type CheckSyntax =
|
|
7
|
+
| boolean
|
|
8
|
+
| {
|
|
9
|
+
targets?: string[];
|
|
10
|
+
exclude?: RegExp | RegExp[];
|
|
11
|
+
ecmaVersion?: EcmaVersion;
|
|
12
|
+
};
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- **Default:** `false`
|
|
16
|
+
|
|
17
|
+
Used to analyze whether there is incompatible advanced syntax in the build artifacts under the current browser scope. If any incompatible syntax is found, detailed information will be printed to the terminal.
|
|
18
|
+
|
|
19
|
+
### Enable Detection
|
|
20
|
+
|
|
21
|
+
You can set `checkSyntax` to `true` to enable syntax checking.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export default {
|
|
25
|
+
security: {
|
|
26
|
+
checkSyntax: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
When you enable `checkSyntax`, Modern.js will perform the detection during production builds. If any incompatible advanced syntax is detected in the build artifacts, error logs will be printed to the terminal, and the current build process will be terminated.
|
|
32
|
+
|
|
33
|
+
### Error Logs
|
|
34
|
+
|
|
35
|
+
The format of the error logs is as follows, including the source file, artifact location, error reason, and source code:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
error [Syntax Checker] Find some syntax errors after production build:
|
|
39
|
+
|
|
40
|
+
Error 1
|
|
41
|
+
source: /node_modules/foo/index.js:1:0
|
|
42
|
+
output: /dist/static/js/main.3f7a4d7e.js:2:39400
|
|
43
|
+
reason: Unexpected token (1:178)
|
|
44
|
+
code:
|
|
45
|
+
9 |
|
|
46
|
+
10 | var b = 2;
|
|
47
|
+
11 |
|
|
48
|
+
> 12 | console.log(() => {
|
|
49
|
+
13 | return a + b;
|
|
50
|
+
14 | });
|
|
51
|
+
15 |
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
:::tip
|
|
55
|
+
Currently, syntax checking is implemented based on AST parser. Each time it performs a check, it can only identify the first incompatible syntax found in the file. If there are multiple incompatible syntaxes in the file, you need to fix the detected syntax and re-run the check.
|
|
56
|
+
If the corresponding source location is not shown in the log, try setting **output.minify** to false and rebuild again.
|
|
57
|
+
:::
|
|
58
|
+
|
|
59
|
+
### Solutions
|
|
60
|
+
|
|
61
|
+
If a syntax error is detected, you can handle it in the following ways:
|
|
62
|
+
|
|
63
|
+
- If you want to downgrade this syntax to ensure good code compatibility, you can compile the corresponding module through the `source.include` config.
|
|
64
|
+
- If you don't want to downgrade the syntax, you can adjust the project's browserslist to match the syntax.
|
|
65
|
+
- If you do not want to check the syntax of certain products, you can use the `checkSyntax.exclude` configuration to exclude the files to be checked.
|
|
66
|
+
|
|
67
|
+
### Options
|
|
68
|
+
|
|
69
|
+
`security.checkSyntax` is implemented based on `@rsbuild/plugin-check-syntax`. For specific options, please refer to [@rsbuild/plugin-check-syntax](https://github.com/rstackjs/rsbuild-plugin-check-syntax).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# security.nonce
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type Nonce = string;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- **Default:** `undefined`
|
|
10
|
+
|
|
11
|
+
Adding a `nonce` attribute to the scripts resources introduced for HTML. This allows the browser to determine whether the script can be executed when it parses inline scripts with matching nonce values.
|
|
12
|
+
|
|
13
|
+
:::info
|
|
14
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - security.nonce](https://v2.rsbuild.dev/config/security/nonce).
|
|
15
|
+
:::
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# security.sri
|
|
2
|
+
|
|
3
|
+
- **Type**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type SriOptions = {
|
|
7
|
+
hashFuncNames?: [string, ...string[]];
|
|
8
|
+
enabled?: 'auto' | true | false;
|
|
9
|
+
};
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- **Default:** `undefined`
|
|
13
|
+
|
|
14
|
+
Adding an `integrity` attribute to `<script>` and `<link rel="stylesheet">` tags introduced by HTML allows the browser to verify the integrity of the introduced resource, thus preventing tampering with the downloaded resource.
|
|
15
|
+
|
|
16
|
+
:::info
|
|
17
|
+
For a specific introduction to SRI, you can refer to [Rsbuild security.sri](https://v2.rsbuild.rs/zh/config/security/sri).
|
|
18
|
+
|
|
19
|
+
This configuration type is not completely consistent with Rsbuild and will be automatically converted during the build process.
|
|
20
|
+
:::
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# server.baseUrl
|
|
2
|
+
|
|
3
|
+
- **Type:** `string | string[]`
|
|
4
|
+
- **Default:** `undefined`
|
|
5
|
+
|
|
6
|
+
Uniformly set the prefix of server-side routes (commonly used in situations where multiple applications share the same domain name to distinguish traffic).
|
|
7
|
+
|
|
8
|
+
```ts title="modern.config.ts"
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
server: {
|
|
11
|
+
// All generated routes will automatically have the prefix `/base`
|
|
12
|
+
// Generated server-side route file path: dist/route.json
|
|
13
|
+
baseUrl: '/base'
|
|
14
|
+
|
|
15
|
+
// Multiple baseUrl
|
|
16
|
+
baseUrl: ['/base-new', '/base-old']
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
After running `dev`, you will see that the route access will have the corresponding prefix added:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
> Local: http://localhost:8080/base/
|
|
25
|
+
> Network: http://192.168.0.1:8080/base/
|
|
26
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# server.port
|
|
2
|
+
|
|
3
|
+
- **Type:** `number`
|
|
4
|
+
- **Default:** `8080`
|
|
5
|
+
|
|
6
|
+
When running the `dev` and `serve` commands, Modern.js will start with `8080` as the default port and automatically increase the port number when the port is occupied. You can use this configuration to modify the port number that the Server starts with:
|
|
7
|
+
|
|
8
|
+
```js title="modern.config.ts"
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
server: {
|
|
11
|
+
port: 3000,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
:::info
|
|
17
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - server.port](https://v2.rsbuild.dev/config/server/port).
|
|
18
|
+
:::
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# server.publicRoutes
|
|
2
|
+
|
|
3
|
+
- **Type:** `Object`
|
|
4
|
+
- **Default:** Server-side routing rules generated based on file conventions, with one route rule generated for each file.
|
|
5
|
+
|
|
6
|
+
This configuration option only applies to server-side routing and can customize the access route of resources under `config/public/`.
|
|
7
|
+
|
|
8
|
+
The `key` of the object is the relative file path of the `config/public/` (without using `./`), and the value can be a `string`.
|
|
9
|
+
|
|
10
|
+
```ts title="modern.config.ts"
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
server: {
|
|
13
|
+
publicRoutes: {
|
|
14
|
+
// Set a long route
|
|
15
|
+
'index.json': '/user-config/card-info/extra/help.json',
|
|
16
|
+
|
|
17
|
+
// Set a route without a suffix
|
|
18
|
+
'robot.txt': '/app/authentication',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|