@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.97 → 3.5.0-ultramodern.99
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/dist/cjs/builder/generator/createBuilderProviderConfig.js +5 -1
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +7 -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/initialize/index.js +4 -3
- package/dist/cjs/plugins/serverBuild.js +3 -2
- package/dist/esm/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +7 -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/initialize/index.mjs +4 -3
- package/dist/esm/plugins/serverBuild.mjs +3 -2
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +7 -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/initialize/index.mjs +4 -3
- package/dist/esm-node/plugins/serverBuild.mjs +3 -2
- 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/types/config/dev.d.ts +6 -0
- package/docs/_nav.json +36 -0
- package/docs/apis/_meta.json +13 -0
- package/docs/apis/app/commands.mdx +205 -0
- package/docs/apis/app/hooks/_meta.json +28 -0
- package/docs/apis/app/hooks/api/lambda.mdx +13 -0
- package/docs/apis/app/hooks/config/_meta.json +1 -0
- package/docs/apis/app/hooks/config/favicon.mdx +29 -0
- package/docs/apis/app/hooks/config/html.mdx +9 -0
- package/docs/apis/app/hooks/config/icon.mdx +29 -0
- package/docs/apis/app/hooks/config/mock.mdx +10 -0
- package/docs/apis/app/hooks/config/public.mdx +30 -0
- package/docs/apis/app/hooks/config/upload.mdx +54 -0
- package/docs/apis/app/hooks/modern-config.mdx +9 -0
- package/docs/apis/app/hooks/server/server.mdx +10 -0
- package/docs/apis/app/hooks/shared.mdx +7 -0
- package/docs/apis/app/hooks/src/app.mdx +30 -0
- package/docs/apis/app/hooks/src/entry.mdx +39 -0
- package/docs/apis/app/hooks/src/entry.server.mdx +56 -0
- package/docs/apis/app/hooks/src/modern.runtime.mdx +9 -0
- package/docs/apis/app/hooks/src/routes.mdx +90 -0
- package/docs/apis/app/hooks/src/server.mdx +7 -0
- package/docs/apis/app/runtime/_meta.json +32 -0
- package/docs/apis/app/runtime/bff/use-backend-context.mdx +30 -0
- package/docs/apis/app/runtime/core/create-root.mdx +22 -0
- package/docs/apis/app/runtime/core/render.mdx +42 -0
- package/docs/apis/app/runtime/core/runtime-context.mdx +160 -0
- package/docs/apis/app/runtime/router/router.mdx +288 -0
- package/docs/apis/app/runtime/ssr/no-ssr.mdx +38 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.mdx +71 -0
- package/docs/apis/app/runtime/ssr/renderString.mdx +64 -0
- package/docs/apis/app/runtime/ssr/requestHandler.mdx +48 -0
- package/docs/apis/app/runtime/utility/css-in-js.mdx +44 -0
- package/docs/apis/app/runtime/utility/head.mdx +38 -0
- package/docs/apis/app/runtime/utility/loadable.mdx +85 -0
- package/docs/components/auto-upgrade.mdx +0 -0
- package/docs/components/bff-upload.mdx +97 -0
- package/docs/components/build-output.mdx +45 -0
- package/docs/components/bundler.mdx +3 -0
- package/docs/components/convention-routing-motivation.mdx +0 -0
- package/docs/components/debug-app.mdx +15 -0
- package/docs/components/default-browserslist.mdx +7 -0
- package/docs/components/deploy-command.mdx +14 -0
- package/docs/components/deploy.mdx +1 -0
- package/docs/components/enable-bff-caution.mdx +3 -0
- package/docs/components/enable-bff.mdx +56 -0
- package/docs/components/enable-ssg.mdx +49 -0
- package/docs/components/entry-mode.mdx +0 -0
- package/docs/components/entry-scan-logic.mdx +7 -0
- package/docs/components/extend-bff-function.mdx +3 -0
- package/docs/components/hono.mdx +120 -0
- package/docs/components/init-app.mdx +93 -0
- package/docs/components/init-rspack-app.mdx +5 -0
- package/docs/components/internal-logger.mdx +25 -0
- package/docs/components/internal-metrics.mdx +20 -0
- package/docs/components/international/custom-instance-code.mdx +16 -0
- package/docs/components/international/init-options-desc.mdx +1 -0
- package/docs/components/international/install-command.mdx +10 -0
- package/docs/components/international/instance-code.mdx +16 -0
- package/docs/components/international/introduce.mdx +5 -0
- package/docs/components/international/platform-support.mdx +0 -0
- package/docs/components/language-config.mdx +9 -0
- package/docs/components/micro-frontend.mdx +6 -0
- package/docs/components/micro-master-manifest-config.mdx +15 -0
- package/docs/components/micro-runtime-config.mdx +17 -0
- package/docs/components/module-federation.mdx +7 -0
- package/docs/components/new-entry-tooltip.mdx +0 -0
- package/docs/components/nodeVersion.mdx +28 -0
- package/docs/components/other-plugins.mdx +0 -0
- package/docs/components/output-asset-prefix-extend.mdx +0 -0
- package/docs/components/output-distpath-warning.mdx +0 -0
- package/docs/components/output-polyfill-extend.mdx +1 -0
- package/docs/components/prerequisites.mdx +18 -0
- package/docs/components/release-note.mdx +1 -0
- package/docs/components/routes-practice.mdx +0 -0
- package/docs/components/rsbuild-config-tooltip.mdx +5 -0
- package/docs/components/rsbuild.mdx +3 -0
- package/docs/components/rsc-deploy-tip.mdx +1 -0
- package/docs/components/rspack.mdx +3 -0
- package/docs/components/rspackTip.mdx +7 -0
- package/docs/components/runtime-cli-config.mdx +0 -0
- package/docs/components/serve-command.mdx +22 -0
- package/docs/components/ssr-monitor.mdx +3 -0
- package/docs/components/stream-ssr-performance.mdx +0 -0
- package/docs/components/swc.mdx +3 -0
- package/docs/components/tech-stack-node-framework.mdx +1 -0
- package/docs/components/turtorials-example-list.mdx +2 -0
- package/docs/components/ua-polyfill.mdx +44 -0
- package/docs/components/upgrade-browserslist.mdx +0 -0
- package/docs/components/upgrade-config-deploy.mdx +0 -0
- package/docs/components/upgrade-faq.mdx +0 -0
- package/docs/configure/_meta.json +78 -0
- package/docs/configure/app/bff/cross-project.mdx +24 -0
- package/docs/configure/app/bff/effect.mdx +319 -0
- package/docs/configure/app/bff/prefix.mdx +33 -0
- package/docs/configure/app/bff/runtime-framework.mdx +30 -0
- package/docs/configure/app/builder-plugins.mdx +70 -0
- package/docs/configure/app/dev/asset-prefix.mdx +18 -0
- package/docs/configure/app/dev/before-start-url.mdx +21 -0
- package/docs/configure/app/dev/client.mdx +45 -0
- package/docs/configure/app/dev/hmr.mdx +14 -0
- package/docs/configure/app/dev/host.mdx +22 -0
- package/docs/configure/app/dev/https.mdx +81 -0
- package/docs/configure/app/dev/lazy-compilation.mdx +45 -0
- package/docs/configure/app/dev/live-reload.mdx +14 -0
- package/docs/configure/app/dev/mock-dir.mdx +35 -0
- package/docs/configure/app/dev/progress-bar.mdx +23 -0
- package/docs/configure/app/dev/server.mdx +128 -0
- package/docs/configure/app/dev/setup-middlewares.mdx +36 -0
- package/docs/configure/app/dev/start-url.mdx +53 -0
- package/docs/configure/app/dev/watch-files.mdx +31 -0
- package/docs/configure/app/dev/write-to-disk.mdx +14 -0
- package/docs/configure/app/experiments/source-build.mdx +33 -0
- package/docs/configure/app/html/app-icon.mdx +32 -0
- package/docs/configure/app/html/crossorigin.mdx +14 -0
- package/docs/configure/app/html/favicon.mdx +20 -0
- package/docs/configure/app/html/inject.mdx +14 -0
- package/docs/configure/app/html/meta.mdx +28 -0
- package/docs/configure/app/html/mount-id.mdx +14 -0
- package/docs/configure/app/html/output-structure.mdx +14 -0
- package/docs/configure/app/html/script-loading.mdx +14 -0
- package/docs/configure/app/html/tags.mdx +19 -0
- package/docs/configure/app/html/template-parameters.mdx +37 -0
- package/docs/configure/app/html/template.mdx +14 -0
- package/docs/configure/app/html/title.mdx +22 -0
- package/docs/configure/app/output/asset-prefix.mdx +18 -0
- package/docs/configure/app/output/assets-retry.mdx +81 -0
- package/docs/configure/app/output/charset.mdx +14 -0
- package/docs/configure/app/output/clean-dist-path.mdx +20 -0
- package/docs/configure/app/output/convert-to-rem.mdx +83 -0
- package/docs/configure/app/output/copy.mdx +14 -0
- package/docs/configure/app/output/css-modules.mdx +52 -0
- package/docs/configure/app/output/data-uri-limit.mdx +30 -0
- package/docs/configure/app/output/disable-css-module-extension.mdx +59 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.mdx +45 -0
- package/docs/configure/app/output/disable-svgr.mdx +22 -0
- package/docs/configure/app/output/disable-ts-checker.mdx +53 -0
- package/docs/configure/app/output/dist-path.mdx +51 -0
- package/docs/configure/app/output/enable-asset-manifest.mdx +40 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.mdx +32 -0
- package/docs/configure/app/output/enable-inline-route-manifests.mdx +20 -0
- package/docs/configure/app/output/externals.mdx +24 -0
- package/docs/configure/app/output/filename-hash.mdx +14 -0
- package/docs/configure/app/output/filename.mdx +59 -0
- package/docs/configure/app/output/inject-styles.mdx +14 -0
- package/docs/configure/app/output/inline-scripts.mdx +33 -0
- package/docs/configure/app/output/inline-styles.mdx +33 -0
- package/docs/configure/app/output/legal-comments.mdx +22 -0
- package/docs/configure/app/output/minify.mdx +26 -0
- package/docs/configure/app/output/override-browserslist.mdx +26 -0
- package/docs/configure/app/output/polyfill.mdx +18 -0
- package/docs/configure/app/output/source-map.mdx +34 -0
- package/docs/configure/app/output/split-route-chunks.mdx +20 -0
- package/docs/configure/app/output/ssg.mdx +85 -0
- package/docs/configure/app/output/ssgByEntries.mdx +93 -0
- package/docs/configure/app/output/svg-default-export.mdx +34 -0
- package/docs/configure/app/output/temp-dir.mdx +24 -0
- package/docs/configure/app/performance/build-cache.mdx +48 -0
- package/docs/configure/app/performance/chunk-split.mdx +44 -0
- package/docs/configure/app/performance/dns-prefetch.mdx +19 -0
- package/docs/configure/app/performance/preconnect.mdx +20 -0
- package/docs/configure/app/performance/prefetch.mdx +25 -0
- package/docs/configure/app/performance/preload.mdx +27 -0
- package/docs/configure/app/performance/print-file-size.mdx +44 -0
- package/docs/configure/app/performance/profile.mdx +14 -0
- package/docs/configure/app/performance/remove-console.mdx +14 -0
- package/docs/configure/app/performance/remove-moment-locale.mdx +14 -0
- package/docs/configure/app/performance/rsdoctor.mdx +42 -0
- package/docs/configure/app/plugins.mdx +59 -0
- package/docs/configure/app/resolve/alias-strategy.mdx +14 -0
- package/docs/configure/app/resolve/alias.mdx +13 -0
- package/docs/configure/app/resolve/condition-names.mdx +18 -0
- package/docs/configure/app/resolve/dedupe.mdx +13 -0
- package/docs/configure/app/resolve/extensions.mdx +18 -0
- package/docs/configure/app/runtime/0-intro.mdx +61 -0
- package/docs/configure/app/runtime/plugins.mdx +58 -0
- package/docs/configure/app/runtime/router.mdx +39 -0
- package/docs/configure/app/security/check-syntax.mdx +73 -0
- package/docs/configure/app/security/nonce.mdx +19 -0
- package/docs/configure/app/security/sri.mdx +24 -0
- package/docs/configure/app/server/base-url.mdx +30 -0
- package/docs/configure/app/server/port.mdx +22 -0
- package/docs/configure/app/server/public-routes.mdx +26 -0
- package/docs/configure/app/server/routes.mdx +90 -0
- package/docs/configure/app/server/rsc.mdx +30 -0
- package/docs/configure/app/server/ssr-by-entries.mdx +29 -0
- package/docs/configure/app/server/ssr.mdx +85 -0
- package/docs/configure/app/server/tsconfig-path.mdx +63 -0
- package/docs/configure/app/source/alias-strategy.mdx +18 -0
- package/docs/configure/app/source/alias.mdx +27 -0
- package/docs/configure/app/source/config-dir.mdx +24 -0
- package/docs/configure/app/source/decorators.mdx +29 -0
- package/docs/configure/app/source/define.mdx +20 -0
- package/docs/configure/app/source/disable-default-entries.mdx +32 -0
- package/docs/configure/app/source/enable-async-entry.mdx +54 -0
- package/docs/configure/app/source/enable-async-pre-entry.mdx +30 -0
- package/docs/configure/app/source/entries-dir.mdx +39 -0
- package/docs/configure/app/source/entries.mdx +183 -0
- package/docs/configure/app/source/exclude.mdx +14 -0
- package/docs/configure/app/source/global-vars.mdx +110 -0
- package/docs/configure/app/source/include.mdx +40 -0
- package/docs/configure/app/source/main-entry-name.mdx +28 -0
- package/docs/configure/app/source/pre-entry.mdx +14 -0
- package/docs/configure/app/source/react-compiler.mdx +72 -0
- package/docs/configure/app/source/transform-import.mdx +31 -0
- package/docs/configure/app/split-chunks.mdx +17 -0
- package/docs/configure/app/tools/autoprefixer.mdx +48 -0
- package/docs/configure/app/tools/bundler-chain.mdx +30 -0
- package/docs/configure/app/tools/css-extract.mdx +37 -0
- package/docs/configure/app/tools/css-loader.mdx +21 -0
- package/docs/configure/app/tools/dev-server.mdx +117 -0
- package/docs/configure/app/tools/html-plugin.mdx +45 -0
- package/docs/configure/app/tools/less.mdx +85 -0
- package/docs/configure/app/tools/lightningcss-loader.mdx +39 -0
- package/docs/configure/app/tools/minify-css.mdx +57 -0
- package/docs/configure/app/tools/postcss.mdx +38 -0
- package/docs/configure/app/tools/rspack.mdx +14 -0
- package/docs/configure/app/tools/sass.mdx +82 -0
- package/docs/configure/app/tools/style-loader.mdx +14 -0
- package/docs/configure/app/tools/swc.mdx +69 -0
- package/docs/configure/app/tools/ts-checker.mdx +103 -0
- package/docs/configure/app/usage.mdx +276 -0
- package/docs/guides/_meta.json +37 -0
- package/docs/guides/advanced-features/_meta.json +32 -0
- package/docs/guides/advanced-features/bff/_meta.json +10 -0
- package/docs/guides/advanced-features/bff/cross-project.mdx +110 -0
- package/docs/guides/advanced-features/bff/data-platform.mdx +120 -0
- package/docs/guides/advanced-features/bff/extend-server.mdx +120 -0
- package/docs/guides/advanced-features/bff/frameworks.mdx +131 -0
- package/docs/guides/advanced-features/bff/function.mdx +265 -0
- package/docs/guides/advanced-features/bff/operators.mdx +629 -0
- package/docs/guides/advanced-features/bff/sdk.mdx +116 -0
- package/docs/guides/advanced-features/bff/upload.mdx +7 -0
- package/docs/guides/advanced-features/bff.mdx +22 -0
- package/docs/guides/advanced-features/build-performance.mdx +134 -0
- package/docs/guides/advanced-features/compatibility.mdx +81 -0
- package/docs/guides/advanced-features/international/_meta.json +10 -0
- package/docs/guides/advanced-features/international/advanced.mdx +132 -0
- package/docs/guides/advanced-features/international/api.mdx +271 -0
- package/docs/guides/advanced-features/international/best-practices.mdx +290 -0
- package/docs/guides/advanced-features/international/configuration.mdx +222 -0
- package/docs/guides/advanced-features/international/locale-detection.mdx +130 -0
- package/docs/guides/advanced-features/international/quick-start.mdx +112 -0
- package/docs/guides/advanced-features/international/resource-loading.mdx +158 -0
- package/docs/guides/advanced-features/international/routing.mdx +177 -0
- package/docs/guides/advanced-features/international.mdx +29 -0
- package/docs/guides/advanced-features/low-level.mdx +50 -0
- package/docs/guides/advanced-features/page-performance/_meta.json +1 -0
- package/docs/guides/advanced-features/page-performance/code-split.mdx +81 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.mdx +163 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.mdx +101 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.mdx +51 -0
- package/docs/guides/advanced-features/server-monitor/_meta.json +1 -0
- package/docs/guides/advanced-features/server-monitor/logger.mdx +19 -0
- package/docs/guides/advanced-features/server-monitor/metrics.mdx +41 -0
- package/docs/guides/advanced-features/server-monitor/monitors.mdx +242 -0
- package/docs/guides/advanced-features/source-build.mdx +168 -0
- package/docs/guides/advanced-features/web-server.mdx +296 -0
- package/docs/guides/basic-features/_meta.json +49 -0
- package/docs/guides/basic-features/alias.mdx +106 -0
- package/docs/guides/basic-features/css/_meta.json +1 -0
- package/docs/guides/basic-features/css/css-in-js.mdx +69 -0
- package/docs/guides/basic-features/css/css-modules.mdx +212 -0
- package/docs/guides/basic-features/css/css.mdx +31 -0
- package/docs/guides/basic-features/css/tailwindcss.mdx +27 -0
- package/docs/guides/basic-features/data/_meta.json +1 -0
- package/docs/guides/basic-features/data/data-cache.mdx +515 -0
- package/docs/guides/basic-features/data/data-fetch.mdx +419 -0
- package/docs/guides/basic-features/data/data-write.mdx +230 -0
- package/docs/guides/basic-features/debug/_meta.json +1 -0
- package/docs/guides/basic-features/debug/mock.mdx +113 -0
- package/docs/guides/basic-features/debug/proxy.mdx +25 -0
- package/docs/guides/basic-features/debug/rsdoctor.mdx +47 -0
- package/docs/guides/basic-features/debug/using-storybook.mdx +100 -0
- package/docs/guides/basic-features/deploy.mdx +448 -0
- package/docs/guides/basic-features/env-vars.mdx +181 -0
- package/docs/guides/basic-features/html.mdx +259 -0
- package/docs/guides/basic-features/output-files.mdx +145 -0
- package/docs/guides/basic-features/render/_meta.json +1 -0
- package/docs/guides/basic-features/render/before-render.mdx +108 -0
- package/docs/guides/basic-features/render/overview.mdx +51 -0
- package/docs/guides/basic-features/render/rsc.mdx +533 -0
- package/docs/guides/basic-features/render/ssg.mdx +167 -0
- package/docs/guides/basic-features/render/ssr-cache.mdx +201 -0
- package/docs/guides/basic-features/render/ssr.mdx +323 -0
- package/docs/guides/basic-features/render/streaming-ssr.mdx +267 -0
- package/docs/guides/basic-features/routes/_meta.json +1 -0
- package/docs/guides/basic-features/routes/config-routes.mdx +427 -0
- package/docs/guides/basic-features/routes/routes.mdx +532 -0
- package/docs/guides/basic-features/static-assets/_meta.json +1 -0
- package/docs/guides/basic-features/static-assets/json-files.mdx +124 -0
- package/docs/guides/basic-features/static-assets/svg-assets.mdx +172 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.mdx +66 -0
- package/docs/guides/basic-features/static-assets.mdx +164 -0
- package/docs/guides/basic-features/testing/_meta.json +1 -0
- package/docs/guides/basic-features/testing/playwright.mdx +111 -0
- package/docs/guides/basic-features/testing/rstest.mdx +192 -0
- package/docs/guides/concept/_meta.json +1 -0
- package/docs/guides/concept/builder.mdx +60 -0
- package/docs/guides/concept/entries.mdx +325 -0
- package/docs/guides/concept/server.mdx +35 -0
- package/docs/guides/get-started/_meta.json +9 -0
- package/docs/guides/get-started/ai-coding-agents.mdx +63 -0
- package/docs/guides/get-started/glossary.mdx +63 -0
- package/docs/guides/get-started/introduction.mdx +45 -0
- package/docs/guides/get-started/quick-start.mdx +92 -0
- package/docs/guides/get-started/tech-stack.mdx +97 -0
- package/docs/guides/get-started/ultramodern.mdx +433 -0
- package/docs/guides/get-started/upgrade.mdx +114 -0
- package/docs/guides/topic-detail/_meta.json +8 -0
- package/docs/guides/topic-detail/module-federation/_meta.json +1 -0
- package/docs/guides/topic-detail/module-federation/application.mdx +116 -0
- package/docs/guides/topic-detail/module-federation/deploy.mdx +104 -0
- package/docs/guides/topic-detail/module-federation/i18n.mdx +670 -0
- package/docs/guides/topic-detail/module-federation/introduce.mdx +36 -0
- package/docs/guides/topic-detail/module-federation/ssr.mdx +177 -0
- package/docs/guides/topic-detail/module-federation/usage.mdx +202 -0
- package/docs/guides/troubleshooting/_meta.json +1 -0
- package/docs/guides/troubleshooting/builder.mdx +114 -0
- package/docs/guides/troubleshooting/cli.mdx +39 -0
- package/docs/guides/troubleshooting/dependencies.mdx +123 -0
- package/docs/guides/troubleshooting/hmr.mdx +148 -0
- package/docs/guides/upgrade/_meta.json +1 -0
- package/docs/guides/upgrade/config.mdx +951 -0
- package/docs/guides/upgrade/entry.mdx +463 -0
- package/docs/guides/upgrade/other.mdx +183 -0
- package/docs/guides/upgrade/overview.mdx +33 -0
- package/docs/guides/upgrade/tailwindcss.mdx +92 -0
- package/docs/guides/upgrade/web-server.md +109 -0
- package/docs/index.md +4 -0
- package/package.json +43 -20
- package/scripts/copy-main-doc.mjs +50 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: prefix
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# bff.prefix
|
|
6
|
+
|
|
7
|
+
- **Type:** `string`
|
|
8
|
+
- **Default:** `/api`
|
|
9
|
+
|
|
10
|
+
import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution";
|
|
11
|
+
|
|
12
|
+
<EnableBFFCaution />
|
|
13
|
+
|
|
14
|
+
By default, the prefix for accessing routes in the BFF API directory is `/api`, as shown in the following directory structure:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
api
|
|
18
|
+
└── hello.ts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The route corresponding to `api/hello.ts` when accessed is `localhost:8080/api/hello`.
|
|
22
|
+
|
|
23
|
+
This configuration option can modify the default route prefix:
|
|
24
|
+
|
|
25
|
+
```ts title="modern.config.ts"
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
bff: {
|
|
28
|
+
prefix: '/api-demo',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The corresponding route for `api/hello.ts` when accessed is `localhost:8080/api-demo/hello`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: runtimeFramework
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# bff.runtimeFramework
|
|
6
|
+
|
|
7
|
+
- **Type:** `'hono' | 'effect'`
|
|
8
|
+
- **Default:** `'effect'`
|
|
9
|
+
|
|
10
|
+
import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution";
|
|
11
|
+
|
|
12
|
+
<EnableBFFCaution />
|
|
13
|
+
|
|
14
|
+
Controls which runtime framework Modern.js uses for BFF routing.
|
|
15
|
+
|
|
16
|
+
```ts title="modern.config.ts"
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
bff: {
|
|
19
|
+
runtimeFramework: 'effect',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Set to `'effect'` to run BFF only from `api/index` (Effect HttpApi runtime).
|
|
25
|
+
- Set to `'hono'` to run BFF only from file-convention handlers under `api/lambda/**`.
|
|
26
|
+
|
|
27
|
+
There is no implicit fallback between runtimes. Choose one runtime mode per app.
|
|
28
|
+
Generated UltraModern apps use strict Effect APIs by default and set
|
|
29
|
+
`bff.effect.strictEffectApproach: true`; `hono` and `api/lambda/**` are not
|
|
30
|
+
valid generated UltraModern HTTP API paths.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 21
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# builderPlugins
|
|
6
|
+
|
|
7
|
+
- **Type:** `RsbuildPlugin[]`
|
|
8
|
+
- **Default:** `[]`
|
|
9
|
+
|
|
10
|
+
Used to configure the Rsbuild plugin.
|
|
11
|
+
|
|
12
|
+
Rsbuild is the build tool of Modern.js, please read [Build Engine](/guides/concept/builder) for background. If you want to know how to write Rsbuild plugins, you can refer to [Rsbuild - Plugin System](https://v2.rsbuild.rs/plugins/dev/index).
|
|
13
|
+
|
|
14
|
+
## Precautions
|
|
15
|
+
|
|
16
|
+
This option **is used to configure the Rsbuild plugins**. If you need to configure other types of plugins, please select the corresponding configs:
|
|
17
|
+
|
|
18
|
+
- Use [plugins](/configure/app/plugins) to configure Modern.js framework plugins.
|
|
19
|
+
- Use [tools.bundlerChain](/configure/app/tools/bundler-chain) to configure Rspack plugins.
|
|
20
|
+
|
|
21
|
+
## When to use
|
|
22
|
+
|
|
23
|
+
In most scenarios, we recommend you to use the Modern.js framework plugin, which can be registered through the [plugins](/configure/app/plugins) config. Because the API provided by the framework plugin is richer and more capable, while the API provided by the Rsbuild plugin can only be used to build scenes.
|
|
24
|
+
|
|
25
|
+
When you need to reference some existing Rsbuild plugins (and there is no related capability in Modern.js), or reuse Rsbuild plugins between different frameworks, you can use the `builderPlugins` field to register them.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
Below is an example of using the Rsbuild plugin.
|
|
30
|
+
|
|
31
|
+
### Using plugins on npm
|
|
32
|
+
|
|
33
|
+
To use a plugin on npm, you need to install the plugin through the package manager and import it.
|
|
34
|
+
|
|
35
|
+
```ts title="modern.config.ts"
|
|
36
|
+
import myRsbuildPlugin from 'my-rsbuild-plugin';
|
|
37
|
+
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
builderPlugins: [myRsbuildPlugin()],
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Using local plugins
|
|
44
|
+
|
|
45
|
+
Use the plugin in the local code repository, you can import it directly through the relative path import.
|
|
46
|
+
|
|
47
|
+
```ts title="modern.config.ts"
|
|
48
|
+
import myRsbuildPlugin from './plugin/myRsbuildPlugin';
|
|
49
|
+
|
|
50
|
+
export default defineConfig({
|
|
51
|
+
builderPlugins: [myRsbuildPlugin()],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Plugin configuration options
|
|
56
|
+
|
|
57
|
+
If the plugin provides some custom configuration options, you can pass in the configuration through the parameters of the plugin function.
|
|
58
|
+
|
|
59
|
+
```ts title="modern.config.ts"
|
|
60
|
+
import myRsbuildPlugin from 'my-rsbuild-plugin';
|
|
61
|
+
|
|
62
|
+
export default defineConfig({
|
|
63
|
+
builderPlugins: [
|
|
64
|
+
myRsbuildPlugin({
|
|
65
|
+
foo: 1,
|
|
66
|
+
bar: 2,
|
|
67
|
+
}),
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: assetPrefix
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.assetPrefix
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean | string | 'auto'`
|
|
8
|
+
- **Default:** `'/'`
|
|
9
|
+
|
|
10
|
+
This configuration item is used to set the URL prefix of static resources in **development mode**.
|
|
11
|
+
|
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
13
|
+
|
|
14
|
+
<RsbuildConfig configName="dev.assetPrefix" />
|
|
15
|
+
|
|
16
|
+
:::warning
|
|
17
|
+
Please note that this configuration item is only applicable in development mode. In production mode, please use the [output.assetPrefix](/configure/app/output/asset-prefix) configuration item for setting.
|
|
18
|
+
:::
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: beforeStartUrl
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.beforeStartUrl
|
|
6
|
+
|
|
7
|
+
- **Type:** `() => Promise<void> | void`
|
|
8
|
+
- **Default:** `undefined`
|
|
9
|
+
|
|
10
|
+
`dev.beforeStartUrl` is used to execute a callback function before opening the `startUrl`, this config needs to be used together with `dev.startUrl`.
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
export default {
|
|
14
|
+
dev: {
|
|
15
|
+
startUrl: true,
|
|
16
|
+
beforeStartUrl: async () => {
|
|
17
|
+
await doSomeThing();
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: client
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.client
|
|
6
|
+
|
|
7
|
+
- **Type:**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type Client = {
|
|
11
|
+
// The protocol name for the WebSocket request
|
|
12
|
+
protocol?: 'ws' | 'wss';
|
|
13
|
+
// The path for the WebSocket request
|
|
14
|
+
path?: string;
|
|
15
|
+
// The port number for the WebSocket request
|
|
16
|
+
port?: string | number;
|
|
17
|
+
// The host for the WebSocket request
|
|
18
|
+
host?: string;
|
|
19
|
+
// The maximum number of reconnection attempts after a WebSocket request is disconnected.
|
|
20
|
+
reconnect?: number;
|
|
21
|
+
// Whether to display an error overlay in the browser when a compilation error occurs
|
|
22
|
+
overlay?: boolean;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- **Default:**
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const defaultConfig = {
|
|
30
|
+
path: '/webpack-hmr',
|
|
31
|
+
port: '<port>',
|
|
32
|
+
// By default it is set to "location.hostname"
|
|
33
|
+
host: '',
|
|
34
|
+
// By default it is set to "location.protocol === 'https:' ? 'wss' : 'ws'""
|
|
35
|
+
protocol: undefined,
|
|
36
|
+
reconnect: 100,
|
|
37
|
+
overlay: false,
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Configure the client code injected by Modern.js during the development process. This can be used to set the WebSocket URL for HMR.
|
|
42
|
+
|
|
43
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
44
|
+
|
|
45
|
+
<RsbuildConfig configName="dev.client" />
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: hmr
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.hmr
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean`
|
|
8
|
+
- **Default:** `true`
|
|
9
|
+
|
|
10
|
+
Whether to enable Hot Module Replacement.
|
|
11
|
+
|
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
13
|
+
|
|
14
|
+
<RsbuildConfig configName="dev.hmr" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: host
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.host
|
|
6
|
+
|
|
7
|
+
- **Type:** `string`
|
|
8
|
+
- **Default:** `0.0.0.0`
|
|
9
|
+
|
|
10
|
+
Specify the host that the dev server listens to.
|
|
11
|
+
|
|
12
|
+
By default, the dev server will listen to `0.0.0.0`, which means listening to all network interfaces, including `localhost` and public network addresses.
|
|
13
|
+
|
|
14
|
+
If you want the dev server to listen only on `localhost`, you can set it to:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export default {
|
|
18
|
+
dev: {
|
|
19
|
+
host: 'localhost',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: https
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.https
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean | { key: string; cert: string }`
|
|
8
|
+
- **Default:** `false`
|
|
9
|
+
|
|
10
|
+
After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server.
|
|
11
|
+
|
|
12
|
+
HTTP:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
> Local: http://localhost:8080/
|
|
16
|
+
> Network: http://192.168.0.1:8080/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
HTTPS:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
> Local: https://localhost:8080/
|
|
23
|
+
> Network: https://192.168.0.1:8080/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Automatically generate certificates
|
|
27
|
+
|
|
28
|
+
You can directly set `https` to `true`, Modern.js will automatically generate the HTTPS certificate based on [devcert](https://github.com/davewasmer/devcert).
|
|
29
|
+
|
|
30
|
+
When using this method, you need to manually install the [devcert](https://github.com/davewasmer/devcert) dependency in your project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# npm
|
|
34
|
+
npm install devcert@1.2.2 -D
|
|
35
|
+
|
|
36
|
+
# yarn
|
|
37
|
+
yarn add devcert@1.2.2 -D
|
|
38
|
+
|
|
39
|
+
# pnpm
|
|
40
|
+
pnpm add devcert@1.2.2 -D
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then configure `dev.https` to `true`:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
export default {
|
|
47
|
+
dev: {
|
|
48
|
+
https: true,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The devcert has some limitations, it does not currently support IP addresses yet.
|
|
54
|
+
|
|
55
|
+
:::tip
|
|
56
|
+
The https proxy automatically installs the certificate and needs root authority, please enter the password according to the prompt.
|
|
57
|
+
**The password is only used to trust the certificate, and will not be leaked or be used elsewhere**.
|
|
58
|
+
:::
|
|
59
|
+
|
|
60
|
+
#### Manually set the certificate
|
|
61
|
+
|
|
62
|
+
You can also manually pass in the certificate and the private key required in the `dev.https` option. This parameter will be directly passed to the createServer method of the https module in Node.js.
|
|
63
|
+
|
|
64
|
+
For details, please refer to [https.createServer](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener).
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import fs from 'fs';
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
dev: {
|
|
71
|
+
https: {
|
|
72
|
+
key: fs.readFileSync('certificates/private.pem'),
|
|
73
|
+
cert: fs.readFileSync('certificates/public.pem'),
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Clean up cert cache
|
|
80
|
+
|
|
81
|
+
The certificate created by devcert is saved in `~/Library/Application\ Support/devcert`. You may do some cleanup if needed.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: lazyCompilation
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.lazyCompilation
|
|
6
|
+
|
|
7
|
+
- **Type:**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type LazyCompilationOptions =
|
|
11
|
+
| boolean
|
|
12
|
+
| {
|
|
13
|
+
/**
|
|
14
|
+
* Enable lazy compilation for entries.
|
|
15
|
+
*/
|
|
16
|
+
entries?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable lazy compilation for dynamic imports.
|
|
19
|
+
*/
|
|
20
|
+
imports?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Specify which imported modules should be lazily compiled.
|
|
23
|
+
*/
|
|
24
|
+
test?: RegExp | ((m: Module) => boolean);
|
|
25
|
+
/**
|
|
26
|
+
* The path to a custom runtime code that overrides the default lazy compilation client.
|
|
27
|
+
*/
|
|
28
|
+
client?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Tells the client the server URL that needs to be requested.
|
|
31
|
+
*/
|
|
32
|
+
serverUrl?: string;
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **Default:** `false`
|
|
37
|
+
|
|
38
|
+
Enable lazy compilation (compilation on demand), implemented based on Rspack's [lazy compilation](https://rspack.rs/guide/features/lazy-compilation) feature.
|
|
39
|
+
|
|
40
|
+
import RsbuildLink from '@site/src/components/RsbuildLink';
|
|
41
|
+
|
|
42
|
+
:::info
|
|
43
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to <RsbuildLink configName="dev.lazyCompilation"/>。
|
|
44
|
+
In Rspack build mode,
|
|
45
|
+
:::
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: liveReload
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.liveReload
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean`
|
|
8
|
+
- **Default:** `true`
|
|
9
|
+
|
|
10
|
+
Whether to reload the page when source files are changed.
|
|
11
|
+
|
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
13
|
+
|
|
14
|
+
<RsbuildConfig configName="dev.liveReload" />
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: mockDir
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.mockDir
|
|
6
|
+
|
|
7
|
+
- **Type:** `string`
|
|
8
|
+
- **Default:** `'./config/mock'`
|
|
9
|
+
|
|
10
|
+
Sets the directory containing the Mock API entry file. Relative paths are
|
|
11
|
+
resolved from the application directory, and absolute paths are also supported.
|
|
12
|
+
Modern.js loads `index.ts` or `index.js` from this directory during development.
|
|
13
|
+
|
|
14
|
+
For example, move the Mock API entry to `mocks/index.ts`:
|
|
15
|
+
|
|
16
|
+
```js title="modern.config.ts"
|
|
17
|
+
import { defineConfig } from '@modern-js/app-tools';
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
dev: {
|
|
21
|
+
mockDir: './mocks',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This is also useful in a monorepo when multiple applications share one Mock
|
|
27
|
+
directory:
|
|
28
|
+
|
|
29
|
+
```js title="modern.config.ts"
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
dev: {
|
|
32
|
+
mockDir: '../../shared/mocks',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: progressBar
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.progressBar
|
|
6
|
+
|
|
7
|
+
- **Type:**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type ProgressBar =
|
|
11
|
+
| boolean
|
|
12
|
+
| {
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **Default:** true
|
|
18
|
+
|
|
19
|
+
Whether to display progress bar during compilation.
|
|
20
|
+
|
|
21
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
22
|
+
|
|
23
|
+
<RsbuildConfig configName="dev.progressBar" />
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: server
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.server
|
|
6
|
+
|
|
7
|
+
- **Type:** `Object`
|
|
8
|
+
- **Default:** `{}`
|
|
9
|
+
|
|
10
|
+
The config of DevServer can be modified through `dev.server`.
|
|
11
|
+
|
|
12
|
+
### compress
|
|
13
|
+
|
|
14
|
+
- **Type:** `boolean`
|
|
15
|
+
- **Default:** `true`
|
|
16
|
+
|
|
17
|
+
Whether to enable gzip compression for served static assets.
|
|
18
|
+
|
|
19
|
+
If you want to disable the gzip compression, you can set `compress` to `false`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
dev: {
|
|
24
|
+
server: {
|
|
25
|
+
compress: false,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For more details, please refer to the [Rsbuild - server.compress](https://v2.rsbuild.rs/config/server/compress) documentation.
|
|
32
|
+
|
|
33
|
+
### headers
|
|
34
|
+
|
|
35
|
+
- **Type:** `Record<string, string>`
|
|
36
|
+
- **Default:** `undefined`
|
|
37
|
+
|
|
38
|
+
Adds headers to all responses.
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
export default {
|
|
42
|
+
dev: {
|
|
43
|
+
server: {
|
|
44
|
+
headers: {
|
|
45
|
+
'X-Custom-Foo': 'bar',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For more details, please refer to the [Rsbuild - server.headers](https://v2.rsbuild.rs/config/server/headers) documentation.
|
|
53
|
+
|
|
54
|
+
### historyApiFallback
|
|
55
|
+
|
|
56
|
+
- **Type:** `boolean | ConnectHistoryApiFallbackOptions`
|
|
57
|
+
- **Default:** `false`
|
|
58
|
+
|
|
59
|
+
The index.html page will likely have to be served in place of any 404 responses. Enable `dev.server.historyApiFallback` by setting it to `true`:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
export default {
|
|
63
|
+
dev: {
|
|
64
|
+
server: {
|
|
65
|
+
historyApiFallback: true,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For more configuration options, please refer to the [Rsbuild - server.historyApiFallback](https://v2.rsbuild.rs/config/server/history-api-fallback) documentation.
|
|
72
|
+
|
|
73
|
+
### watch
|
|
74
|
+
|
|
75
|
+
- **Type:** `boolean`
|
|
76
|
+
- **Default:** `true`
|
|
77
|
+
|
|
78
|
+
Whether to watch files change in directories such as `mock/`, `server/`, `api/`.
|
|
79
|
+
|
|
80
|
+
For more details, please refer to the [Rsbuild - dev.watchFiles](https://v2.rsbuild.rs/config/dev/watch-files) documentation.
|
|
81
|
+
|
|
82
|
+
### cors
|
|
83
|
+
|
|
84
|
+
- **Type:** `boolean | import('cors').CorsOptions`
|
|
85
|
+
|
|
86
|
+
Configure CORS (Cross-Origin Resource Sharing) for the development server.
|
|
87
|
+
|
|
88
|
+
The default configuration for `cors` in Modern.js follows Rsbuild's defaults:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const defaultAllowedOrigins =
|
|
92
|
+
/^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
|
93
|
+
|
|
94
|
+
const defaultOptions = {
|
|
95
|
+
// Default allowed:
|
|
96
|
+
// - localhost
|
|
97
|
+
// - 127.0.0.1
|
|
98
|
+
// - [::1]
|
|
99
|
+
origin: defaultAllowedOrigins,
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For more configuration options and detailed usage, please refer to the [Rsbuild - server.cors](https://v2.rsbuild.rs/config/server/cors) documentation.
|
|
104
|
+
|
|
105
|
+
### proxy
|
|
106
|
+
|
|
107
|
+
- **Type:** `ProxyOptions[] | Record<string, string | ProxyOptions>`
|
|
108
|
+
- **Default:** `undefined`
|
|
109
|
+
|
|
110
|
+
Configure proxy rules for the dev server, and forward requests to the specified service.
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
export default {
|
|
114
|
+
dev: {
|
|
115
|
+
server: {
|
|
116
|
+
proxy: {
|
|
117
|
+
// http://localhost:8080/api -> https://example.com/api
|
|
118
|
+
// http://localhost:8080/api/foo -> https://example.com/api/foo
|
|
119
|
+
'/api': 'https://example.com',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
:::tip
|
|
127
|
+
This option is the same as Rsbuild's `server.proxy` option, see [Rsbuild - server.proxy](https://v2.rsbuild.rs/config/server/proxy) for detailed usage.
|
|
128
|
+
:::
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: setupMiddlewares
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.setupMiddlewares
|
|
6
|
+
|
|
7
|
+
- **Type:**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type RequestHandler = (req: any, res: any, next: () => void) => void;
|
|
11
|
+
|
|
12
|
+
type ExposeServerApis = {
|
|
13
|
+
sockWrite: (
|
|
14
|
+
type: string,
|
|
15
|
+
data?: string | boolean | Record<string, any>,
|
|
16
|
+
) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type SetupMiddlewares = Array<
|
|
20
|
+
(
|
|
21
|
+
middlewares: {
|
|
22
|
+
unshift: (...handlers: RequestHandler[]) => void;
|
|
23
|
+
push: (...handlers: RequestHandler[]) => void;
|
|
24
|
+
},
|
|
25
|
+
server: ExposeServerApis,
|
|
26
|
+
) => void
|
|
27
|
+
>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **Default:** `undefined`
|
|
31
|
+
|
|
32
|
+
Provides the ability to execute a custom function and apply custom middlewares.
|
|
33
|
+
|
|
34
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
|
35
|
+
|
|
36
|
+
<RsbuildConfig configName="dev.setupMiddlewares" />
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: startUrl
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dev.startUrl
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean | string | string[] | undefined`
|
|
8
|
+
- **Default:** `undefined`
|
|
9
|
+
|
|
10
|
+
`dev.startUrl` is used to set the URL of the page that automatically opens in the browser when Dev Server starts.
|
|
11
|
+
|
|
12
|
+
By default, no page will be opened.
|
|
13
|
+
|
|
14
|
+
You can set it to the following values:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default {
|
|
18
|
+
dev: {
|
|
19
|
+
// Open the project's default preview page, equivalent to `http://localhost:<port>`
|
|
20
|
+
startUrl: true,
|
|
21
|
+
// Open the specified page
|
|
22
|
+
startUrl: 'http://localhost:8080',
|
|
23
|
+
// Open multiple pages
|
|
24
|
+
startUrl: ['http://localhost:8080', 'http://localhost:8080/about'],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Port placeholder
|
|
30
|
+
|
|
31
|
+
Since the port number may change, you can use the `<port>` placeholder to refer to the current port number, and Modern.js will automatically replace the placeholder with the actual listening port number.
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
export default {
|
|
35
|
+
dev: {
|
|
36
|
+
startUrl: 'http://localhost:<port>/home',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Open the specified browser
|
|
42
|
+
|
|
43
|
+
On MacOS, you can open the specified browser when Dev Server starts, by set environment variable `BROWSER`, support values:
|
|
44
|
+
|
|
45
|
+
- Google Chrome Canary
|
|
46
|
+
- Google Chrome Dev
|
|
47
|
+
- Google Chrome Beta
|
|
48
|
+
- Google Chrome
|
|
49
|
+
- Microsoft Edge
|
|
50
|
+
- Brave Browser
|
|
51
|
+
- Vivaldi
|
|
52
|
+
- Chromium
|
|
53
|
+
|