@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,36 @@
|
|
|
1
|
+
# output.enableAssetManifest
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether to generate a manifest file that contains information of all assets.
|
|
7
|
+
|
|
8
|
+
### Example
|
|
9
|
+
|
|
10
|
+
Enable asset manifest:
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
export default {
|
|
14
|
+
output: {
|
|
15
|
+
enableAssetManifest: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
After compiler, there will be a `dist/manifest.json` file:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"files": {
|
|
25
|
+
"main.css": "/static/css/main.45b01211.css",
|
|
26
|
+
"main.js": "/static/js/main.52fd298f.js",
|
|
27
|
+
"html/main/index.html": "/html/main/index.html"
|
|
28
|
+
},
|
|
29
|
+
"entrypoints": ["static/css/main.45b01211.css", "static/js/main.52fd298f.js"]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If the current project has multiple types of build artifacts, such as including SSR build artifacts, multiple manifest.json files will be generated.
|
|
34
|
+
|
|
35
|
+
- web artifact: `asset-manifest.json`
|
|
36
|
+
- node artifact: `asset-manifest-node.json`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# output.enableCssModuleTSDeclaration
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether to generate a TypeScript declaration file for CSS modules.
|
|
7
|
+
|
|
8
|
+
### Example
|
|
9
|
+
|
|
10
|
+
Enable CSS module TypeScript declaration:
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
export default {
|
|
14
|
+
output: {
|
|
15
|
+
enableCssModuleTSDeclaration: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
After building, there will be a `.d.ts` file for each CSS module file. For example
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
interface CssExports {
|
|
24
|
+
title: string;
|
|
25
|
+
}
|
|
26
|
+
export const cssExports: CssExports;
|
|
27
|
+
export default cssExports;
|
|
28
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# output.disableInlineRouteManifests
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
When using convention-based routing, the framework injects routing information into the client for optimization purposes. By default, routing information is injected into the html, but when this is configured to `true`, routing information is injected into a separate JS file.
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
export default {
|
|
12
|
+
output: {
|
|
13
|
+
disableInlineRouteManifests: true,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# output.externals
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type Externals =
|
|
7
|
+
| string
|
|
8
|
+
| object
|
|
9
|
+
| function
|
|
10
|
+
| RegExp
|
|
11
|
+
| Array<string | object | function | RegExp>;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **Default:** `undefined`
|
|
15
|
+
|
|
16
|
+
At build time, prevent some `import` dependencies from being packed into bundles in your code, and instead fetch them externally at runtime.
|
|
17
|
+
|
|
18
|
+
:::info
|
|
19
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.externals](https://v2.rsbuild.dev/config/output/externals).
|
|
20
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# output.filenameHash
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean | string`
|
|
4
|
+
- **Default:** `true`
|
|
5
|
+
|
|
6
|
+
Whether to add a hash value to the filename after the 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 - output.filenameHash](https://v2.rsbuild.dev/config/output/filename-hash).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# output.filename
|
|
2
|
+
|
|
3
|
+
:::warning
|
|
4
|
+
|
|
5
|
+
In Modern.js `dev` command or use Modern.js server deployment, don't modify the html output filename. This will cause the page to be 404.
|
|
6
|
+
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
- **Type:**
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
type FilenameConfig = {
|
|
13
|
+
js?:
|
|
14
|
+
| string
|
|
15
|
+
| ((pathData: Rspack.PathData, assetInfo: Rspack.JsAssetInfo) => string);
|
|
16
|
+
css?: string;
|
|
17
|
+
svg?: string;
|
|
18
|
+
font?: string;
|
|
19
|
+
image?: string;
|
|
20
|
+
media?: string;
|
|
21
|
+
assets?: string;
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **Default:**
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
// Development mode
|
|
29
|
+
const devDefaultFilename = {
|
|
30
|
+
js: '[name].js',
|
|
31
|
+
css: '[name].css',
|
|
32
|
+
svg: '[name].[contenthash:8].svg',
|
|
33
|
+
font: '[name].[contenthash:8][ext]',
|
|
34
|
+
image: '[name].[contenthash:8][ext]',
|
|
35
|
+
media: '[name].[contenthash:8][ext]',
|
|
36
|
+
assets: '[name].[contenthash:8][ext]',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Production mode
|
|
40
|
+
const prodDefaultFilename = {
|
|
41
|
+
js: output.target === 'node' ? '[name].js' : '[name].[contenthash:8].js',
|
|
42
|
+
css: '[name].[contenthash:8].css',
|
|
43
|
+
svg: '[name].[contenthash:8].svg',
|
|
44
|
+
font: '[name].[contenthash:8][ext]',
|
|
45
|
+
image: '[name].[contenthash:8][ext]',
|
|
46
|
+
media: '[name].[contenthash:8][ext]',
|
|
47
|
+
assets: '[name].[contenthash:8][ext]',
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Sets the filename of dist files.
|
|
52
|
+
|
|
53
|
+
:::info
|
|
54
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.filename](https://v2.rsbuild.dev/config/output/filename).
|
|
55
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# output.injectStyles
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
Whether to inject styles into DOM.
|
|
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 - output.injectStyles](https://v2.rsbuild.dev/config/output/inject-styles).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# output.inlineScripts
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type InlineScriptsTest =
|
|
7
|
+
| RegExp
|
|
8
|
+
| ((params: { size: number; name: string }) => boolean);
|
|
9
|
+
|
|
10
|
+
type InlineScripts =
|
|
11
|
+
| boolean
|
|
12
|
+
| InlineScriptsTest
|
|
13
|
+
| {
|
|
14
|
+
enable?: boolean | 'auto';
|
|
15
|
+
test: InlineScriptsTest;
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Default:** `/builder-runtime([.].+)?\.js$/`
|
|
20
|
+
|
|
21
|
+
Whether to inline output scripts files (.js files) into HTML with `<script>` tags.
|
|
22
|
+
|
|
23
|
+
:::tip
|
|
24
|
+
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks.md) to false if this option is turned on.
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
:::info
|
|
28
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.inlineScripts](https://v2.rsbuild.dev/config/output/inline-scripts).
|
|
29
|
+
:::
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# output.inlineStyles
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type InlineStylesTest =
|
|
7
|
+
| RegExp
|
|
8
|
+
| ((params: { size: number; name: string }) => boolean);
|
|
9
|
+
|
|
10
|
+
type InlineStyles =
|
|
11
|
+
| boolean
|
|
12
|
+
| InlineStylesTest
|
|
13
|
+
| {
|
|
14
|
+
enable?: boolean | 'auto';
|
|
15
|
+
test: InlineStylesTest;
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Default:** `false`
|
|
20
|
+
|
|
21
|
+
Whether to inline output style files (.css files) into HTML with `<style>` tags.
|
|
22
|
+
|
|
23
|
+
:::tip
|
|
24
|
+
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks.md) to false if this option is turned on.
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
:::info
|
|
28
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.inlineStyles](https://v2.rsbuild.dev/config/output/inline-styles).
|
|
29
|
+
:::
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# output.legalComments
|
|
2
|
+
|
|
3
|
+
- **Type:** `'linked' | 'inline' | 'none'`
|
|
4
|
+
- **Default:** `'linked'`
|
|
5
|
+
|
|
6
|
+
Configure how to handle the legal comment.
|
|
7
|
+
|
|
8
|
+
A "legal comment" is considered to be any statement-level comment in JS or rule-level comment in CSS that contains `@license` or `@preserve` or that starts with `//!` or `/*!`. These comments are preserved in output files by default since that follows the intent of the original authors of the code.
|
|
9
|
+
|
|
10
|
+
This behavior can be configured by using one of the following options:
|
|
11
|
+
|
|
12
|
+
- `linked`: Extract all legal comments to a .LEGAL.txt file and link to them with a comment.
|
|
13
|
+
- `inline`: Preserve all legal comments in original position.
|
|
14
|
+
- `none`: Remove all legal comments.
|
|
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 - output.legalComments](https://v2.rsbuild.dev/config/output/legal-comments).
|
|
18
|
+
:::
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# output.minify
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type Minify =
|
|
7
|
+
| boolean
|
|
8
|
+
| {
|
|
9
|
+
js?: boolean;
|
|
10
|
+
jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
11
|
+
css?: boolean;
|
|
12
|
+
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- **Default:** `true`
|
|
17
|
+
|
|
18
|
+
Configure whether to enable code minification in production mode, or to configure minimizer options.
|
|
19
|
+
|
|
20
|
+
:::info
|
|
21
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.minify](https://v2.rsbuild.dev/config/output/minify).
|
|
22
|
+
:::
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# output.overrideBrowserslist
|
|
2
|
+
|
|
3
|
+
- **Type:** `string[] | undefined`
|
|
4
|
+
- **Default:**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
const defaultBrowserListMap: Record<RsbuildTarget, string[]> = {
|
|
8
|
+
web: ['chrome >= 87', 'edge >= 88', 'firefox >= 78', 'safari >= 14'],
|
|
9
|
+
node: ['node >= 14'],
|
|
10
|
+
'web-worker': ['chrome >= 87', 'edge >= 88', 'firefox >= 78', 'safari >= 14'],
|
|
11
|
+
};
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Specifies the range of target browsers that the project is compatible with.
|
|
15
|
+
|
|
16
|
+
This value will be used by [SWC](https://github.com/swc-project/swc) and [autoprefixer](https://github.com/postcss/autoprefixer) to identify the JavaScript syntax that need to be transformed and the CSS browser prefixes that need to be added.
|
|
17
|
+
|
|
18
|
+
For other configuration methods and configuration priorities, please refer to the [Browserslist configuration](/guides/advanced-features/compatibility.md).
|
|
19
|
+
|
|
20
|
+
:::info
|
|
21
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.overrideBrowserslist](https://v2.rsbuild.dev/config/output/override-browserslist).
|
|
22
|
+
:::
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# output.polyfill
|
|
2
|
+
|
|
3
|
+
- **Type:** `'entry' | 'usage' | 'ua' | 'off'`
|
|
4
|
+
- **Default:** `'entry'`
|
|
5
|
+
|
|
6
|
+
Via `output.polyfill` you can configure how the polyfill is injected.
|
|
7
|
+
|
|
8
|
+
Modern.js also provides a runtime Polyfill solution based on browser [UA](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/User-Agent) information. For detailed usage instructions, please refer to [Polyfill At Runtime](https://modernjs.dev/en/guides/advanced-features/compatibility.html#polyfill-at-runtime).
|
|
9
|
+
|
|
10
|
+
:::info
|
|
11
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.polyfill](https://v2.rsbuild.dev/config/output/polyfill).
|
|
12
|
+
:::
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# output.sourceMap
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type SourceMap =
|
|
7
|
+
| boolean
|
|
8
|
+
| {
|
|
9
|
+
js?: Rspack.Configuration['devtool'];
|
|
10
|
+
css?: boolean;
|
|
11
|
+
};
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **Default:**
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const defaultSourceMap = {
|
|
18
|
+
js: isDev ? 'cheap-module-source-map' : 'hidden-source-map',
|
|
19
|
+
css: isDev,
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
When `output.sourceMap` is not configured, the source map generation rules of Modern.js are different from Rsbuild:
|
|
24
|
+
|
|
25
|
+
- In the development mode, JS and CSS source maps are generated for development debugging.
|
|
26
|
+
- In the production mode, JS source maps are generated for stack trace backtracking, and CSS source maps are not generated to provide the best build performance.
|
|
27
|
+
|
|
28
|
+
:::info
|
|
29
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - output.sourceMap](https://v2.rsbuild.dev/config/output/source-map).
|
|
30
|
+
:::
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# output.splitRouteChunks
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `true`
|
|
5
|
+
|
|
6
|
+
When using convention-based routing, the framework will split js and css based on the route to load on demand. If your project does not want to split js and css based on routes, you can set this option to `false`.
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
export default {
|
|
12
|
+
output: {
|
|
13
|
+
splitRouteChunks: false,
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# output.ssg
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean | object`
|
|
4
|
+
- **Default Value:** `undefined`
|
|
5
|
+
|
|
6
|
+
Configuration to enable the application’s SSG (Static Site Generation) feature.
|
|
7
|
+
|
|
8
|
+
:::tip Enabling SSG
|
|
9
|
+
This configuration takes effect only when SSG is enabled. Please read the [Static Site Generation](/guides/basic-features/render/ssg.md) documentation to understand how to enable SSG and its use cases.
|
|
10
|
+
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
:::info Recommended Reading
|
|
14
|
+
The SSG feature is closely related to routing. It is recommended to understand the [routing solution](/guides/basic-features/routes/routes.md) before using SSG.
|
|
15
|
+
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
:::info
|
|
19
|
+
|
|
20
|
+
- Use `output.ssg` for single-entry apps.
|
|
21
|
+
- For multi-entry apps, prefer `output.ssgByEntries`.
|
|
22
|
+
- If `output.ssg` is `true` and `output.ssgByEntries` is not set, all routes under all entries are treated as SSG routes.
|
|
23
|
+
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
## Boolean Type
|
|
27
|
+
|
|
28
|
+
When this configuration is set to `true`, the SSG feature will be enabled for all entries by default. For **manual routing**, the root route of the entry will be rendered. For **conventional routing**, each route in the entry will be rendered.
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
output: {
|
|
33
|
+
ssg: true,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Object Type
|
|
39
|
+
|
|
40
|
+
When the value type is `Object`, the following attributes can be configured.
|
|
41
|
+
|
|
42
|
+
### Configuration Type
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
type SSGRouteOptions =
|
|
46
|
+
| string
|
|
47
|
+
| {
|
|
48
|
+
url: string;
|
|
49
|
+
headers?: Record<string, any>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type SSGOptions = {
|
|
53
|
+
headers?: Record<string, any>;
|
|
54
|
+
routes?: SSGRouteOptions[];
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
In the example configuration below, SSG will render the pages corresponding to the `/`, `/about`, and `/user/:id` routes.
|
|
61
|
+
|
|
62
|
+
For the `/user/:id` route, `cookies` will be added to the request headers.
|
|
63
|
+
|
|
64
|
+
```ts title="modern.config.ts"
|
|
65
|
+
export default defineConfig({
|
|
66
|
+
output: {
|
|
67
|
+
ssg: {
|
|
68
|
+
routes: [
|
|
69
|
+
'/',
|
|
70
|
+
'/about',
|
|
71
|
+
{
|
|
72
|
+
url: '/user/modernjs',
|
|
73
|
+
headers: {
|
|
74
|
+
cookies: 'name=modernjs',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# output.ssgByEntries
|
|
2
|
+
|
|
3
|
+
- **Type:** `Record<string, boolean | object>`
|
|
4
|
+
- **Default Value:** `undefined`
|
|
5
|
+
|
|
6
|
+
Configure SSG per entry for multi-entry applications.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
|
|
10
|
+
- Use `output.ssg` for single-entry apps.
|
|
11
|
+
- For multi-entry apps, prefer `output.ssgByEntries`.
|
|
12
|
+
- If `output.ssg` is `true` and `output.ssgByEntries` is not set, all routes under all entries are treated as SSG routes.
|
|
13
|
+
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
## Configuration Type
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
type SSGRouteOptions =
|
|
20
|
+
| string
|
|
21
|
+
| {
|
|
22
|
+
url: string;
|
|
23
|
+
headers?: Record<string, any>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type SSGOptions = {
|
|
27
|
+
headers?: Record<string, any>;
|
|
28
|
+
routes?: SSGRouteOptions[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// ssgByEntries type
|
|
32
|
+
type SSGMultiEntryOptions = Record<string, boolean | SSGOptions>;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Enable SSG for some entries
|
|
38
|
+
|
|
39
|
+
```ts title="modern.config.ts"
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
output: {
|
|
42
|
+
ssgByEntries: {
|
|
43
|
+
home: true,
|
|
44
|
+
admin: false,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Configure routes per entry
|
|
51
|
+
|
|
52
|
+
```ts title="modern.config.ts"
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
output: {
|
|
55
|
+
ssgByEntries: {
|
|
56
|
+
home: {
|
|
57
|
+
routes: ['/', '/about', '/user/modernjs'],
|
|
58
|
+
},
|
|
59
|
+
admin: {
|
|
60
|
+
routes: ['/', '/dashboard'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Configure headers per entry or route
|
|
68
|
+
|
|
69
|
+
```ts title="modern.config.ts"
|
|
70
|
+
export default defineConfig({
|
|
71
|
+
output: {
|
|
72
|
+
ssgByEntries: {
|
|
73
|
+
home: {
|
|
74
|
+
headers: {
|
|
75
|
+
'x-tt-env': 'ppe_modernjs',
|
|
76
|
+
},
|
|
77
|
+
routes: [
|
|
78
|
+
'/',
|
|
79
|
+
{
|
|
80
|
+
url: '/about',
|
|
81
|
+
headers: {
|
|
82
|
+
from: 'modern-website',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# output.svgDefaultExport
|
|
2
|
+
|
|
3
|
+
- **Type:** `'url' | 'component'`
|
|
4
|
+
- **Default:** `'url'`
|
|
5
|
+
|
|
6
|
+
`output.svgDefaultExport` is used to configure the default export type of SVG files.
|
|
7
|
+
|
|
8
|
+
When `output.svgDefaultExport` is set to `url` , the default export of SVG files is the URL of the file. For example:
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import logo from './logo.svg';
|
|
12
|
+
|
|
13
|
+
console.log(logo); // => asset url
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
When `output.svgDefaultExport` is set to `component` , the default export of SVG files is the React component of the file. For example:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import Logo from './logo.svg';
|
|
20
|
+
|
|
21
|
+
console.log(Logo); // => React Component
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
At this time, you can also specify the `?url` query to import the URL, for example:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import logo from './logo.svg?url';
|
|
28
|
+
|
|
29
|
+
console.log(logo); // => asset url
|
|
30
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# output.tempDir
|
|
2
|
+
|
|
3
|
+
- **Type:** `string`
|
|
4
|
+
- **Default:** `''`
|
|
5
|
+
|
|
6
|
+
When developing or building a project, Modern.js generates real Rspack entries and HTML templates, placing them in a temporary directory.
|
|
7
|
+
|
|
8
|
+
If you want to start a project with multiple configurations at the same time, you can use this configuration to generate files in different temporary directories to avoid interference with each other.
|
|
9
|
+
|
|
10
|
+
The configuration can be a relative or absolute path, but paths outside the project should be avoided.
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
export default {
|
|
16
|
+
output: {
|
|
17
|
+
tempDir: path.join('node_modules', '.temp-dir'),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# performance.buildCache
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type BuildCacheConfig =
|
|
7
|
+
| {
|
|
8
|
+
/**
|
|
9
|
+
* Base directory for the filesystem cache.
|
|
10
|
+
*/
|
|
11
|
+
cacheDirectory?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Set different cache names based on cacheDigest content.
|
|
14
|
+
*/
|
|
15
|
+
cacheDigest?: Array<string | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* An arrays of additional code dependencies for the build.
|
|
18
|
+
* Rspack will use a hash of each of these items and all dependencies to invalidate the filesystem cache.
|
|
19
|
+
*/
|
|
20
|
+
buildDependencies?: string[];
|
|
21
|
+
}
|
|
22
|
+
| boolean;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Controls the caching behavior during the build process.
|
|
26
|
+
|
|
27
|
+
When persistent Rspack cache is enabled, Modern.js treats `cacheDirectory` as a
|
|
28
|
+
base directory and stores each Rsbuild/Rspack environment in its own child
|
|
29
|
+
directory, such as `client`, `server`, or `workerSSR`. This avoids concurrent
|
|
30
|
+
environment compilers writing to the same filesystem cache root.
|
|
31
|
+
|
|
32
|
+
Modern.js will enable build cache by default to improve the compile speed. You can disable the build cache by setting it to `false`:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
export default {
|
|
36
|
+
performance: {
|
|
37
|
+
buildCache: false,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
:::info
|
|
43
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.buildCache](https://v2.rsbuild.dev/config/performance/build-cache).
|
|
44
|
+
:::
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# performance.chunkSplit
|
|
2
|
+
|
|
3
|
+
- **Type:** `Object`
|
|
4
|
+
- **Default:** `{ strategy: 'split-by-experience' }`
|
|
5
|
+
|
|
6
|
+
`performance.chunkSplit` is used to configure the chunk splitting strategy. The type of `ChunkSplit` is as follows:
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
type ForceSplitting = RegExp[] | Record<string, RegExp>;
|
|
10
|
+
|
|
11
|
+
interface BaseChunkSplit {
|
|
12
|
+
strategy?:
|
|
13
|
+
| 'split-by-module'
|
|
14
|
+
| 'split-by-experience'
|
|
15
|
+
| 'all-in-one'
|
|
16
|
+
| 'single-vendor';
|
|
17
|
+
override?: SplitChunks;
|
|
18
|
+
forceSplitting?: ForceSplitting;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SplitBySize {
|
|
22
|
+
strategy?: 'split-by-size';
|
|
23
|
+
minSize?: number;
|
|
24
|
+
maxSize?: number;
|
|
25
|
+
override?: SplitChunks;
|
|
26
|
+
forceSplitting?: ForceSplitting;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface SplitCustom {
|
|
30
|
+
strategy?: 'custom';
|
|
31
|
+
splitChunks?: SplitChunks;
|
|
32
|
+
forceSplitting?: ForceSplitting;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
|
|
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.chunkSplit](https://v2.rsbuild.dev/config/performance/chunk-split).
|
|
40
|
+
:::
|