@bleedingdev/modern-js-main-doc 3.2.0-ultramodern.0
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/LICENSE +21 -0
- package/README.md +23 -0
- package/builder-doc/docs/en/config/performance/rsdoctor.md +37 -0
- package/builder-doc/docs/zh/config/performance/rsdoctor.md +37 -0
- package/docs/en/_nav.json +36 -0
- package/docs/en/apis/_meta.json +13 -0
- package/docs/en/apis/app/commands.mdx +215 -0
- package/docs/en/apis/app/hooks/_meta.json +28 -0
- package/docs/en/apis/app/hooks/api/lambda.mdx +13 -0
- package/docs/en/apis/app/hooks/config/_meta.json +1 -0
- package/docs/en/apis/app/hooks/config/favicon.mdx +29 -0
- package/docs/en/apis/app/hooks/config/html.mdx +9 -0
- package/docs/en/apis/app/hooks/config/icon.mdx +29 -0
- package/docs/en/apis/app/hooks/config/mock.mdx +7 -0
- package/docs/en/apis/app/hooks/config/public.mdx +30 -0
- package/docs/en/apis/app/hooks/config/upload.mdx +54 -0
- package/docs/en/apis/app/hooks/modern-config.mdx +9 -0
- package/docs/en/apis/app/hooks/server/server.mdx +10 -0
- package/docs/en/apis/app/hooks/shared.mdx +7 -0
- package/docs/en/apis/app/hooks/src/app.mdx +30 -0
- package/docs/en/apis/app/hooks/src/entry.mdx +39 -0
- package/docs/en/apis/app/hooks/src/entry.server.mdx +56 -0
- package/docs/en/apis/app/hooks/src/modern.runtime.mdx +9 -0
- package/docs/en/apis/app/hooks/src/routes.mdx +90 -0
- package/docs/en/apis/app/hooks/src/server.mdx +7 -0
- package/docs/en/apis/app/runtime/_meta.json +32 -0
- package/docs/en/apis/app/runtime/bff/use-backend-context.mdx +30 -0
- package/docs/en/apis/app/runtime/core/create-root.mdx +22 -0
- package/docs/en/apis/app/runtime/core/render.mdx +42 -0
- package/docs/en/apis/app/runtime/core/runtime-context.mdx +160 -0
- package/docs/en/apis/app/runtime/router/router.mdx +288 -0
- package/docs/en/apis/app/runtime/ssr/no-ssr.mdx +38 -0
- package/docs/en/apis/app/runtime/ssr/renderStreaming.mdx +71 -0
- package/docs/en/apis/app/runtime/ssr/renderString.mdx +64 -0
- package/docs/en/apis/app/runtime/ssr/requestHandler.mdx +48 -0
- package/docs/en/apis/app/runtime/utility/css-in-js.mdx +44 -0
- package/docs/en/apis/app/runtime/utility/head.mdx +38 -0
- package/docs/en/apis/app/runtime/utility/loadable.mdx +85 -0
- package/docs/en/community/_meta.json +11 -0
- package/docs/en/community/blog/2022-0708-updates.md +95 -0
- package/docs/en/community/blog/2022-0910-updates.md +80 -0
- package/docs/en/community/blog/_meta.json +7 -0
- package/docs/en/community/blog/overview.md +67 -0
- package/docs/en/community/blog/v2-release-note.mdx +244 -0
- package/docs/en/community/blog/v3-release-note.mdx +628 -0
- package/docs/en/community/contributing-guide.mdx +257 -0
- package/docs/en/community/releases.mdx +31 -0
- package/docs/en/community/showcase.mdx +15 -0
- package/docs/en/community/team.mdx +29 -0
- package/docs/en/components/auto-upgrade.mdx +0 -0
- package/docs/en/components/bff-upload.mdx +97 -0
- package/docs/en/components/build-output.mdx +45 -0
- package/docs/en/components/bundler.mdx +3 -0
- package/docs/en/components/convention-routing-motivation.mdx +0 -0
- package/docs/en/components/debug-app.mdx +15 -0
- package/docs/en/components/default-browserslist.mdx +7 -0
- package/docs/en/components/deploy-command.mdx +14 -0
- package/docs/en/components/deploy.mdx +1 -0
- package/docs/en/components/enable-bff-caution.mdx +3 -0
- package/docs/en/components/enable-bff.mdx +56 -0
- package/docs/en/components/enable-ssg.mdx +49 -0
- package/docs/en/components/entry-mode.mdx +0 -0
- package/docs/en/components/entry-scan-logic.mdx +7 -0
- package/docs/en/components/extend-bff-function.mdx +3 -0
- package/docs/en/components/hono.mdx +120 -0
- package/docs/en/components/init-app.mdx +111 -0
- package/docs/en/components/init-rspack-app.mdx +5 -0
- package/docs/en/components/internal-logger.mdx +25 -0
- package/docs/en/components/internal-metrics.mdx +20 -0
- package/docs/en/components/international/custom-instance-code.mdx +16 -0
- package/docs/en/components/international/init-options-desc.mdx +1 -0
- package/docs/en/components/international/install-command.mdx +10 -0
- package/docs/en/components/international/instance-code.mdx +16 -0
- package/docs/en/components/international/introduce.mdx +5 -0
- package/docs/en/components/international/platform-support.mdx +0 -0
- package/docs/en/components/language-config.mdx +9 -0
- package/docs/en/components/micro-frontend.mdx +6 -0
- package/docs/en/components/micro-master-manifest-config.mdx +15 -0
- package/docs/en/components/micro-runtime-config.mdx +17 -0
- package/docs/en/components/module-federation.mdx +7 -0
- package/docs/en/components/new-entry-tooltip.mdx +0 -0
- package/docs/en/components/nodeVersion.mdx +28 -0
- package/docs/en/components/other-plugins.mdx +0 -0
- package/docs/en/components/output-asset-prefix-extend.mdx +0 -0
- package/docs/en/components/output-distpath-warning.mdx +0 -0
- package/docs/en/components/output-polyfill-extend.mdx +1 -0
- package/docs/en/components/prerequisites.mdx +18 -0
- package/docs/en/components/release-note.mdx +1 -0
- package/docs/en/components/routes-practice.mdx +0 -0
- package/docs/en/components/rsbuild-config-tooltip.mdx +5 -0
- package/docs/en/components/rsbuild.mdx +3 -0
- package/docs/en/components/rsc-deploy-tip.mdx +1 -0
- package/docs/en/components/rspack.mdx +3 -0
- package/docs/en/components/rspackTip.mdx +7 -0
- package/docs/en/components/runtime-cli-config.mdx +0 -0
- package/docs/en/components/serve-command.mdx +22 -0
- package/docs/en/components/ssr-monitor.mdx +3 -0
- package/docs/en/components/stream-ssr-performance.mdx +0 -0
- package/docs/en/components/swc.mdx +3 -0
- package/docs/en/components/tech-stack-node-framework.mdx +1 -0
- package/docs/en/components/turtorials-example-list.mdx +2 -0
- package/docs/en/components/ua-polyfill.mdx +44 -0
- package/docs/en/components/upgrade-browserslist.mdx +0 -0
- package/docs/en/components/upgrade-config-deploy.mdx +0 -0
- package/docs/en/components/upgrade-faq.mdx +0 -0
- package/docs/en/configure/_meta.json +78 -0
- package/docs/en/configure/app/bff/cross-project.mdx +24 -0
- package/docs/en/configure/app/bff/effect.mdx +152 -0
- package/docs/en/configure/app/bff/prefix.mdx +33 -0
- package/docs/en/configure/app/bff/runtime-framework.mdx +28 -0
- package/docs/en/configure/app/builder-plugins.mdx +70 -0
- package/docs/en/configure/app/dev/asset-prefix.mdx +18 -0
- package/docs/en/configure/app/dev/before-start-url.mdx +21 -0
- package/docs/en/configure/app/dev/client.mdx +45 -0
- package/docs/en/configure/app/dev/hmr.mdx +14 -0
- package/docs/en/configure/app/dev/host.mdx +22 -0
- package/docs/en/configure/app/dev/https.mdx +81 -0
- package/docs/en/configure/app/dev/lazy-compilation.mdx +45 -0
- package/docs/en/configure/app/dev/live-reload.mdx +14 -0
- package/docs/en/configure/app/dev/progress-bar.mdx +23 -0
- package/docs/en/configure/app/dev/server.mdx +128 -0
- package/docs/en/configure/app/dev/setup-middlewares.mdx +36 -0
- package/docs/en/configure/app/dev/start-url.mdx +53 -0
- package/docs/en/configure/app/dev/watch-files.mdx +31 -0
- package/docs/en/configure/app/dev/write-to-disk.mdx +14 -0
- package/docs/en/configure/app/experiments/source-build.mdx +33 -0
- package/docs/en/configure/app/html/app-icon.mdx +32 -0
- package/docs/en/configure/app/html/crossorigin.mdx +14 -0
- package/docs/en/configure/app/html/favicon.mdx +20 -0
- package/docs/en/configure/app/html/inject.mdx +14 -0
- package/docs/en/configure/app/html/meta.mdx +28 -0
- package/docs/en/configure/app/html/mount-id.mdx +14 -0
- package/docs/en/configure/app/html/output-structure.mdx +14 -0
- package/docs/en/configure/app/html/script-loading.mdx +14 -0
- package/docs/en/configure/app/html/tags.mdx +19 -0
- package/docs/en/configure/app/html/template-parameters.mdx +37 -0
- package/docs/en/configure/app/html/template.mdx +14 -0
- package/docs/en/configure/app/html/title.mdx +22 -0
- package/docs/en/configure/app/output/asset-prefix.mdx +18 -0
- package/docs/en/configure/app/output/assets-retry.mdx +81 -0
- package/docs/en/configure/app/output/charset.mdx +14 -0
- package/docs/en/configure/app/output/clean-dist-path.mdx +20 -0
- package/docs/en/configure/app/output/convert-to-rem.mdx +83 -0
- package/docs/en/configure/app/output/copy.mdx +14 -0
- package/docs/en/configure/app/output/css-modules.mdx +52 -0
- package/docs/en/configure/app/output/data-uri-limit.mdx +30 -0
- package/docs/en/configure/app/output/disable-css-module-extension.mdx +59 -0
- package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +45 -0
- package/docs/en/configure/app/output/disable-svgr.mdx +20 -0
- package/docs/en/configure/app/output/disable-ts-checker.mdx +53 -0
- package/docs/en/configure/app/output/dist-path.mdx +51 -0
- package/docs/en/configure/app/output/enable-asset-manifest.mdx +40 -0
- package/docs/en/configure/app/output/enable-css-module-tsdeclaration.mdx +32 -0
- package/docs/en/configure/app/output/enable-inline-route-manifests.mdx +20 -0
- package/docs/en/configure/app/output/externals.mdx +24 -0
- package/docs/en/configure/app/output/filename-hash.mdx +14 -0
- package/docs/en/configure/app/output/filename.mdx +59 -0
- package/docs/en/configure/app/output/inject-styles.mdx +14 -0
- package/docs/en/configure/app/output/inline-scripts.mdx +33 -0
- package/docs/en/configure/app/output/inline-styles.mdx +33 -0
- package/docs/en/configure/app/output/legal-comments.mdx +22 -0
- package/docs/en/configure/app/output/minify.mdx +26 -0
- package/docs/en/configure/app/output/override-browserslist.mdx +26 -0
- package/docs/en/configure/app/output/polyfill.mdx +18 -0
- package/docs/en/configure/app/output/source-map.mdx +34 -0
- package/docs/en/configure/app/output/split-route-chunks.mdx +20 -0
- package/docs/en/configure/app/output/ssg.mdx +85 -0
- package/docs/en/configure/app/output/ssgByEntries.mdx +93 -0
- package/docs/en/configure/app/output/svg-default-export.mdx +34 -0
- package/docs/en/configure/app/output/temp-dir.mdx +24 -0
- package/docs/en/configure/app/performance/build-cache.mdx +43 -0
- package/docs/en/configure/app/performance/chunk-split.mdx +44 -0
- package/docs/en/configure/app/performance/dns-prefetch.mdx +19 -0
- package/docs/en/configure/app/performance/preconnect.mdx +20 -0
- package/docs/en/configure/app/performance/prefetch.mdx +25 -0
- package/docs/en/configure/app/performance/preload.mdx +27 -0
- package/docs/en/configure/app/performance/print-file-size.mdx +44 -0
- package/docs/en/configure/app/performance/profile.mdx +14 -0
- package/docs/en/configure/app/performance/remove-console.mdx +14 -0
- package/docs/en/configure/app/performance/remove-moment-locale.mdx +14 -0
- package/docs/en/configure/app/performance/rsdoctor.mdx +39 -0
- package/docs/en/configure/app/plugins.mdx +59 -0
- package/docs/en/configure/app/resolve/alias-strategy.mdx +14 -0
- package/docs/en/configure/app/resolve/alias.mdx +13 -0
- package/docs/en/configure/app/resolve/condition-names.mdx +18 -0
- package/docs/en/configure/app/resolve/dedupe.mdx +13 -0
- package/docs/en/configure/app/resolve/extensions.mdx +18 -0
- package/docs/en/configure/app/runtime/0-intro.mdx +61 -0
- package/docs/en/configure/app/runtime/plugins.mdx +58 -0
- package/docs/en/configure/app/runtime/router.mdx +39 -0
- package/docs/en/configure/app/security/check-syntax.mdx +73 -0
- package/docs/en/configure/app/security/nonce.mdx +19 -0
- package/docs/en/configure/app/security/sri.mdx +24 -0
- package/docs/en/configure/app/server/base-url.mdx +30 -0
- package/docs/en/configure/app/server/port.mdx +22 -0
- package/docs/en/configure/app/server/public-routes.mdx +26 -0
- package/docs/en/configure/app/server/routes.mdx +90 -0
- package/docs/en/configure/app/server/rsc.mdx +30 -0
- package/docs/en/configure/app/server/ssr-by-entries.mdx +29 -0
- package/docs/en/configure/app/server/ssr.mdx +85 -0
- package/docs/en/configure/app/server/tsconfig-path.mdx +63 -0
- package/docs/en/configure/app/source/alias-strategy.mdx +18 -0
- package/docs/en/configure/app/source/alias.mdx +27 -0
- package/docs/en/configure/app/source/config-dir.mdx +24 -0
- package/docs/en/configure/app/source/decorators.mdx +29 -0
- package/docs/en/configure/app/source/define.mdx +20 -0
- package/docs/en/configure/app/source/disable-default-entries.mdx +32 -0
- package/docs/en/configure/app/source/enable-async-entry.mdx +54 -0
- package/docs/en/configure/app/source/enable-async-pre-entry.mdx +30 -0
- package/docs/en/configure/app/source/entries-dir.mdx +39 -0
- package/docs/en/configure/app/source/entries.mdx +183 -0
- package/docs/en/configure/app/source/exclude.mdx +14 -0
- package/docs/en/configure/app/source/global-vars.mdx +110 -0
- package/docs/en/configure/app/source/include.mdx +40 -0
- package/docs/en/configure/app/source/main-entry-name.mdx +28 -0
- package/docs/en/configure/app/source/pre-entry.mdx +14 -0
- package/docs/en/configure/app/source/transform-import.mdx +31 -0
- package/docs/en/configure/app/split-chunks.mdx +17 -0
- package/docs/en/configure/app/tools/autoprefixer.mdx +48 -0
- package/docs/en/configure/app/tools/bundler-chain.mdx +30 -0
- package/docs/en/configure/app/tools/css-extract.mdx +37 -0
- package/docs/en/configure/app/tools/css-loader.mdx +21 -0
- package/docs/en/configure/app/tools/dev-server.mdx +117 -0
- package/docs/en/configure/app/tools/html-plugin.mdx +45 -0
- package/docs/en/configure/app/tools/less.mdx +85 -0
- package/docs/en/configure/app/tools/lightningcss-loader.mdx +39 -0
- package/docs/en/configure/app/tools/minify-css.mdx +57 -0
- package/docs/en/configure/app/tools/postcss.mdx +38 -0
- package/docs/en/configure/app/tools/rspack.mdx +14 -0
- package/docs/en/configure/app/tools/sass.mdx +82 -0
- package/docs/en/configure/app/tools/style-loader.mdx +14 -0
- package/docs/en/configure/app/tools/swc.mdx +69 -0
- package/docs/en/configure/app/tools/ts-checker.mdx +56 -0
- package/docs/en/configure/app/usage.mdx +276 -0
- package/docs/en/guides/_meta.json +37 -0
- package/docs/en/guides/advanced-features/_meta.json +32 -0
- package/docs/en/guides/advanced-features/bff/_meta.json +10 -0
- package/docs/en/guides/advanced-features/bff/cross-project.mdx +110 -0
- package/docs/en/guides/advanced-features/bff/data-platform.mdx +118 -0
- package/docs/en/guides/advanced-features/bff/extend-server.mdx +120 -0
- package/docs/en/guides/advanced-features/bff/frameworks.mdx +118 -0
- package/docs/en/guides/advanced-features/bff/function.mdx +261 -0
- package/docs/en/guides/advanced-features/bff/operators.mdx +629 -0
- package/docs/en/guides/advanced-features/bff/sdk.mdx +116 -0
- package/docs/en/guides/advanced-features/bff/upload.mdx +7 -0
- package/docs/en/guides/advanced-features/bff.mdx +22 -0
- package/docs/en/guides/advanced-features/build-performance.mdx +134 -0
- package/docs/en/guides/advanced-features/compatibility.mdx +81 -0
- package/docs/en/guides/advanced-features/international/_meta.json +10 -0
- package/docs/en/guides/advanced-features/international/advanced.mdx +132 -0
- package/docs/en/guides/advanced-features/international/api.mdx +235 -0
- package/docs/en/guides/advanced-features/international/best-practices.mdx +290 -0
- package/docs/en/guides/advanced-features/international/configuration.mdx +221 -0
- package/docs/en/guides/advanced-features/international/locale-detection.mdx +130 -0
- package/docs/en/guides/advanced-features/international/quick-start.mdx +112 -0
- package/docs/en/guides/advanced-features/international/resource-loading.mdx +158 -0
- package/docs/en/guides/advanced-features/international/routing.mdx +134 -0
- package/docs/en/guides/advanced-features/international.mdx +29 -0
- package/docs/en/guides/advanced-features/low-level.mdx +50 -0
- package/docs/en/guides/advanced-features/page-performance/_meta.json +1 -0
- package/docs/en/guides/advanced-features/page-performance/code-split.mdx +81 -0
- package/docs/en/guides/advanced-features/page-performance/inline-assets.mdx +163 -0
- package/docs/en/guides/advanced-features/page-performance/optimize-bundle.mdx +101 -0
- package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +54 -0
- package/docs/en/guides/advanced-features/server-monitor/_meta.json +1 -0
- package/docs/en/guides/advanced-features/server-monitor/logger.mdx +19 -0
- package/docs/en/guides/advanced-features/server-monitor/metrics.mdx +41 -0
- package/docs/en/guides/advanced-features/server-monitor/monitors.mdx +242 -0
- package/docs/en/guides/advanced-features/source-build.mdx +168 -0
- package/docs/en/guides/advanced-features/web-server.mdx +284 -0
- package/docs/en/guides/basic-features/_meta.json +49 -0
- package/docs/en/guides/basic-features/alias.mdx +106 -0
- package/docs/en/guides/basic-features/css/_meta.json +1 -0
- package/docs/en/guides/basic-features/css/css-in-js.mdx +69 -0
- package/docs/en/guides/basic-features/css/css-modules.mdx +212 -0
- package/docs/en/guides/basic-features/css/css.mdx +31 -0
- package/docs/en/guides/basic-features/css/tailwindcss.mdx +27 -0
- package/docs/en/guides/basic-features/data/_meta.json +1 -0
- package/docs/en/guides/basic-features/data/data-cache.mdx +515 -0
- package/docs/en/guides/basic-features/data/data-fetch.mdx +419 -0
- package/docs/en/guides/basic-features/data/data-write.mdx +230 -0
- package/docs/en/guides/basic-features/debug/_meta.json +1 -0
- package/docs/en/guides/basic-features/debug/mock.mdx +102 -0
- package/docs/en/guides/basic-features/debug/proxy.mdx +25 -0
- package/docs/en/guides/basic-features/debug/rsdoctor.mdx +48 -0
- package/docs/en/guides/basic-features/debug/using-storybook.mdx +100 -0
- package/docs/en/guides/basic-features/deploy.mdx +448 -0
- package/docs/en/guides/basic-features/env-vars.mdx +181 -0
- package/docs/en/guides/basic-features/html.mdx +259 -0
- package/docs/en/guides/basic-features/output-files.mdx +145 -0
- package/docs/en/guides/basic-features/render/_meta.json +10 -0
- package/docs/en/guides/basic-features/render/before-render.mdx +108 -0
- package/docs/en/guides/basic-features/render/overview.mdx +52 -0
- package/docs/en/guides/basic-features/render/rsc.mdx +534 -0
- package/docs/en/guides/basic-features/render/ssg.mdx +167 -0
- package/docs/en/guides/basic-features/render/ssr-cache.mdx +201 -0
- package/docs/en/guides/basic-features/render/ssr.mdx +323 -0
- package/docs/en/guides/basic-features/render/streaming-ssr.mdx +267 -0
- package/docs/en/guides/basic-features/render/tanstack-rsc.mdx +226 -0
- package/docs/en/guides/basic-features/routes/_meta.json +1 -0
- package/docs/en/guides/basic-features/routes/config-routes.mdx +427 -0
- package/docs/en/guides/basic-features/routes/routes.mdx +517 -0
- package/docs/en/guides/basic-features/static-assets/_meta.json +1 -0
- package/docs/en/guides/basic-features/static-assets/json-files.mdx +124 -0
- package/docs/en/guides/basic-features/static-assets/svg-assets.mdx +172 -0
- package/docs/en/guides/basic-features/static-assets/wasm-assets.mdx +66 -0
- package/docs/en/guides/basic-features/static-assets.mdx +164 -0
- package/docs/en/guides/basic-features/testing/_meta.json +1 -0
- package/docs/en/guides/basic-features/testing/cypress.mdx +95 -0
- package/docs/en/guides/basic-features/testing/jest.mdx +148 -0
- package/docs/en/guides/basic-features/testing/playwright.mdx +111 -0
- package/docs/en/guides/basic-features/testing/rstest.mdx +163 -0
- package/docs/en/guides/basic-features/testing/vitest.mdx +100 -0
- package/docs/en/guides/concept/_meta.json +1 -0
- package/docs/en/guides/concept/builder.mdx +60 -0
- package/docs/en/guides/concept/entries.mdx +325 -0
- package/docs/en/guides/concept/server.mdx +35 -0
- package/docs/en/guides/get-started/_meta.json +8 -0
- package/docs/en/guides/get-started/glossary.mdx +63 -0
- package/docs/en/guides/get-started/introduction.mdx +45 -0
- package/docs/en/guides/get-started/quick-start.mdx +92 -0
- package/docs/en/guides/get-started/tech-stack.mdx +91 -0
- package/docs/en/guides/get-started/ultramodern.mdx +98 -0
- package/docs/en/guides/get-started/upgrade.mdx +114 -0
- package/docs/en/guides/topic-detail/_meta.json +8 -0
- package/docs/en/guides/topic-detail/module-federation/_meta.json +1 -0
- package/docs/en/guides/topic-detail/module-federation/application.mdx +116 -0
- package/docs/en/guides/topic-detail/module-federation/deploy.mdx +104 -0
- package/docs/en/guides/topic-detail/module-federation/i18n.mdx +670 -0
- package/docs/en/guides/topic-detail/module-federation/introduce.mdx +36 -0
- package/docs/en/guides/topic-detail/module-federation/ssr.mdx +170 -0
- package/docs/en/guides/topic-detail/module-federation/usage.mdx +202 -0
- package/docs/en/guides/troubleshooting/_meta.json +1 -0
- package/docs/en/guides/troubleshooting/builder.mdx +114 -0
- package/docs/en/guides/troubleshooting/cli.mdx +39 -0
- package/docs/en/guides/troubleshooting/dependencies.mdx +123 -0
- package/docs/en/guides/troubleshooting/hmr.mdx +148 -0
- package/docs/en/guides/upgrade/_meta.json +1 -0
- package/docs/en/guides/upgrade/config.mdx +949 -0
- package/docs/en/guides/upgrade/entry.mdx +463 -0
- package/docs/en/guides/upgrade/other.mdx +183 -0
- package/docs/en/guides/upgrade/overview.mdx +33 -0
- package/docs/en/guides/upgrade/tailwindcss.mdx +92 -0
- package/docs/en/guides/upgrade/web-server.md +109 -0
- package/docs/en/index.md +4 -0
- package/docs/en/plugin/_meta.json +25 -0
- package/docs/en/plugin/cli-plugins/_meta.json +1 -0
- package/docs/en/plugin/cli-plugins/api.mdx +573 -0
- package/docs/en/plugin/cli-plugins/life-cycle.mdx +135 -0
- package/docs/en/plugin/introduction.mdx +153 -0
- package/docs/en/plugin/official/_meta.json +7 -0
- package/docs/en/plugin/official/cli-plugins/_meta.json +1 -0
- package/docs/en/plugin/official/cli-plugins/plugin-bff.mdx +5 -0
- package/docs/en/plugin/official/cli-plugins/plugin-ssg.mdx +5 -0
- package/docs/en/plugin/official/cli-plugins/plugin-styled-components.mdx +5 -0
- package/docs/en/plugin/official/cli-plugins.mdx +4 -0
- package/docs/en/plugin/plugin-system.mdx +244 -0
- package/docs/en/plugin/runtime-plugins/_meta.json +1 -0
- package/docs/en/plugin/runtime-plugins/api.mdx +193 -0
- package/docs/en/plugin/runtime-plugins/life-cycle.mdx +29 -0
- package/docs/en/plugin/server-plugins/_meta.json +1 -0
- package/docs/en/plugin/server-plugins/api.mdx +212 -0
- package/docs/en/plugin/server-plugins/life-cycle.mdx +43 -0
- package/docs/en/tutorials/_meta.json +7 -0
- package/docs/en/tutorials/examples/csr-auth.mdx +31 -0
- package/docs/en/tutorials/foundations/introduction.mdx +22 -0
- package/docs/zh/_nav.json +36 -0
- package/docs/zh/apis/_meta.json +13 -0
- package/docs/zh/apis/app/commands.mdx +215 -0
- package/docs/zh/apis/app/hooks/_meta.json +28 -0
- package/docs/zh/apis/app/hooks/api/lambda.mdx +14 -0
- package/docs/zh/apis/app/hooks/config/_meta.json +1 -0
- package/docs/zh/apis/app/hooks/config/favicon.mdx +29 -0
- package/docs/zh/apis/app/hooks/config/html.mdx +9 -0
- package/docs/zh/apis/app/hooks/config/icon.mdx +29 -0
- package/docs/zh/apis/app/hooks/config/mock.mdx +7 -0
- package/docs/zh/apis/app/hooks/config/public.mdx +30 -0
- package/docs/zh/apis/app/hooks/config/upload.mdx +54 -0
- package/docs/zh/apis/app/hooks/modern-config.mdx +9 -0
- package/docs/zh/apis/app/hooks/server/server.mdx +10 -0
- package/docs/zh/apis/app/hooks/shared.mdx +7 -0
- package/docs/zh/apis/app/hooks/src/app.mdx +36 -0
- package/docs/zh/apis/app/hooks/src/entry.mdx +39 -0
- package/docs/zh/apis/app/hooks/src/entry.server.mdx +56 -0
- package/docs/zh/apis/app/hooks/src/modern.runtime.mdx +9 -0
- package/docs/zh/apis/app/hooks/src/routes.mdx +90 -0
- package/docs/zh/apis/app/hooks/src/server.mdx +7 -0
- package/docs/zh/apis/app/runtime/_meta.json +32 -0
- package/docs/zh/apis/app/runtime/bff/use-backend-context.mdx +31 -0
- package/docs/zh/apis/app/runtime/core/create-root.mdx +22 -0
- package/docs/zh/apis/app/runtime/core/render.mdx +43 -0
- package/docs/zh/apis/app/runtime/core/runtime-context.mdx +160 -0
- package/docs/zh/apis/app/runtime/router/router.mdx +287 -0
- package/docs/zh/apis/app/runtime/ssr/no-ssr.mdx +38 -0
- package/docs/zh/apis/app/runtime/ssr/renderStreaming.mdx +71 -0
- package/docs/zh/apis/app/runtime/ssr/renderString.mdx +64 -0
- package/docs/zh/apis/app/runtime/ssr/requestHandler.mdx +48 -0
- package/docs/zh/apis/app/runtime/utility/css-in-js.mdx +44 -0
- package/docs/zh/apis/app/runtime/utility/head.mdx +38 -0
- package/docs/zh/apis/app/runtime/utility/loadable.mdx +83 -0
- package/docs/zh/community/_meta.json +11 -0
- package/docs/zh/community/blog/2022-0708-updates.md +95 -0
- package/docs/zh/community/blog/2022-0910-updates.md +80 -0
- package/docs/zh/community/blog/_meta.json +7 -0
- package/docs/zh/community/blog/overview.md +74 -0
- package/docs/zh/community/blog/v2-release-note.mdx +244 -0
- package/docs/zh/community/blog/v3-release-note.mdx +628 -0
- package/docs/zh/community/contributing-guide.mdx +256 -0
- package/docs/zh/community/releases.mdx +31 -0
- package/docs/zh/community/showcase.mdx +15 -0
- package/docs/zh/community/team.mdx +29 -0
- package/docs/zh/components/auto-upgrade.mdx +0 -0
- package/docs/zh/components/bff-operator-code.mdx +5 -0
- package/docs/zh/components/bff-upload.mdx +98 -0
- package/docs/zh/components/build-output.mdx +45 -0
- package/docs/zh/components/bundler.mdx +3 -0
- package/docs/zh/components/convention-routing-motivation.mdx +0 -0
- package/docs/zh/components/debug-app.mdx +16 -0
- package/docs/zh/components/default-browserslist.mdx +7 -0
- package/docs/zh/components/deploy-command.mdx +14 -0
- package/docs/zh/components/deploy.mdx +1 -0
- package/docs/zh/components/enable-bff-caution.mdx +4 -0
- package/docs/zh/components/enable-bff.mdx +56 -0
- package/docs/zh/components/enable-ssg.mdx +49 -0
- package/docs/zh/components/entry-mode.mdx +0 -0
- package/docs/zh/components/entry-scan-logic.mdx +7 -0
- package/docs/zh/components/extend-bff-function.mdx +3 -0
- package/docs/zh/components/hono.mdx +120 -0
- package/docs/zh/components/init-app.mdx +111 -0
- package/docs/zh/components/init-rspack-app.mdx +5 -0
- package/docs/zh/components/internal-logger.mdx +25 -0
- package/docs/zh/components/internal-metrics.mdx +20 -0
- package/docs/zh/components/international/custom-instance-code.mdx +16 -0
- package/docs/zh/components/international/init-options-desc.mdx +1 -0
- package/docs/zh/components/international/install-command.mdx +11 -0
- package/docs/zh/components/international/instance-code.mdx +16 -0
- package/docs/zh/components/international/introduce.mdx +5 -0
- package/docs/zh/components/international/platform-support.mdx +0 -0
- package/docs/zh/components/language-config.mdx +9 -0
- package/docs/zh/components/micro-frontend.mdx +6 -0
- package/docs/zh/components/micro-master-manifest-config.mdx +15 -0
- package/docs/zh/components/micro-runtime-config.mdx +17 -0
- package/docs/zh/components/module-federation.mdx +7 -0
- package/docs/zh/components/new-entry-tooltip.mdx +0 -0
- package/docs/zh/components/nodeVersion.mdx +28 -0
- package/docs/zh/components/other-plugins.mdx +0 -0
- package/docs/zh/components/output-asset-prefix-extend.mdx +0 -0
- package/docs/zh/components/output-distpath-warning.mdx +0 -0
- package/docs/zh/components/output-polyfill-extend.mdx +1 -0
- package/docs/zh/components/prerequisites.mdx +18 -0
- package/docs/zh/components/release-note.mdx +1 -0
- package/docs/zh/components/routes-practice.mdx +0 -0
- package/docs/zh/components/rsbuild-config-tooltip.mdx +5 -0
- package/docs/zh/components/rsbuild.mdx +3 -0
- package/docs/zh/components/rsc-deploy-tip.mdx +1 -0
- package/docs/zh/components/rspack.mdx +3 -0
- package/docs/zh/components/rspackTip.mdx +7 -0
- package/docs/zh/components/runtime-cli-config.mdx +0 -0
- package/docs/zh/components/self-route-example.mdx +21 -0
- package/docs/zh/components/serve-command.mdx +22 -0
- package/docs/zh/components/ssr-monitor.mdx +3 -0
- package/docs/zh/components/stream-ssr-performance.mdx +0 -0
- package/docs/zh/components/swc.mdx +3 -0
- package/docs/zh/components/tech-stack-node-framework.mdx +1 -0
- package/docs/zh/components/turtorials-example-list.mdx +2 -0
- package/docs/zh/components/ua-polyfill.mdx +44 -0
- package/docs/zh/components/upgrade-browserslist.mdx +0 -0
- package/docs/zh/components/upgrade-config-deploy.mdx +0 -0
- package/docs/zh/components/upgrade-faq.mdx +0 -0
- package/docs/zh/configure/_meta.json +78 -0
- package/docs/zh/configure/app/bff/cross-project.mdx +24 -0
- package/docs/zh/configure/app/bff/effect.mdx +152 -0
- package/docs/zh/configure/app/bff/prefix.mdx +33 -0
- package/docs/zh/configure/app/bff/runtime-framework.mdx +28 -0
- package/docs/zh/configure/app/builder-plugins.mdx +72 -0
- package/docs/zh/configure/app/dev/asset-prefix.mdx +18 -0
- package/docs/zh/configure/app/dev/before-start-url.mdx +21 -0
- package/docs/zh/configure/app/dev/client.mdx +45 -0
- package/docs/zh/configure/app/dev/hmr.mdx +14 -0
- package/docs/zh/configure/app/dev/host.mdx +22 -0
- package/docs/zh/configure/app/dev/https.mdx +82 -0
- package/docs/zh/configure/app/dev/lazy-compilation.mdx +44 -0
- package/docs/zh/configure/app/dev/live-reload.mdx +14 -0
- package/docs/zh/configure/app/dev/progress-bar.mdx +23 -0
- package/docs/zh/configure/app/dev/server.mdx +128 -0
- package/docs/zh/configure/app/dev/setup-middlewares.mdx +36 -0
- package/docs/zh/configure/app/dev/start-url.mdx +54 -0
- package/docs/zh/configure/app/dev/watch-files.mdx +31 -0
- package/docs/zh/configure/app/dev/write-to-disk.mdx +14 -0
- package/docs/zh/configure/app/experiments/source-build.mdx +35 -0
- package/docs/zh/configure/app/html/app-icon.mdx +32 -0
- package/docs/zh/configure/app/html/crossorigin.mdx +15 -0
- package/docs/zh/configure/app/html/favicon.mdx +21 -0
- package/docs/zh/configure/app/html/inject.mdx +14 -0
- package/docs/zh/configure/app/html/meta.mdx +28 -0
- package/docs/zh/configure/app/html/mount-id.mdx +14 -0
- package/docs/zh/configure/app/html/output-structure.mdx +14 -0
- package/docs/zh/configure/app/html/script-loading.mdx +14 -0
- package/docs/zh/configure/app/html/tags.mdx +19 -0
- package/docs/zh/configure/app/html/template-parameters.mdx +37 -0
- package/docs/zh/configure/app/html/template.mdx +14 -0
- package/docs/zh/configure/app/html/title.mdx +22 -0
- package/docs/zh/configure/app/output/asset-prefix.mdx +18 -0
- package/docs/zh/configure/app/output/assets-retry.mdx +81 -0
- package/docs/zh/configure/app/output/charset.mdx +14 -0
- package/docs/zh/configure/app/output/clean-dist-path.mdx +20 -0
- package/docs/zh/configure/app/output/convert-to-rem.mdx +84 -0
- package/docs/zh/configure/app/output/copy.mdx +14 -0
- package/docs/zh/configure/app/output/css-modules.mdx +52 -0
- package/docs/zh/configure/app/output/data-uri-limit.mdx +30 -0
- package/docs/zh/configure/app/output/disable-css-module-extension.mdx +59 -0
- package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +45 -0
- package/docs/zh/configure/app/output/disable-svgr.mdx +21 -0
- package/docs/zh/configure/app/output/disable-ts-checker.mdx +53 -0
- package/docs/zh/configure/app/output/dist-path.mdx +50 -0
- package/docs/zh/configure/app/output/enable-asset-manifest.mdx +40 -0
- package/docs/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +32 -0
- package/docs/zh/configure/app/output/enable-inline-route-manifests.mdx +21 -0
- package/docs/zh/configure/app/output/externals.mdx +24 -0
- package/docs/zh/configure/app/output/filename-hash.mdx +14 -0
- package/docs/zh/configure/app/output/filename.mdx +62 -0
- package/docs/zh/configure/app/output/inject-styles.mdx +14 -0
- package/docs/zh/configure/app/output/inline-scripts.mdx +33 -0
- package/docs/zh/configure/app/output/inline-styles.mdx +33 -0
- package/docs/zh/configure/app/output/legal-comments.mdx +22 -0
- package/docs/zh/configure/app/output/minify.mdx +26 -0
- package/docs/zh/configure/app/output/override-browserslist.mdx +26 -0
- package/docs/zh/configure/app/output/polyfill.mdx +18 -0
- package/docs/zh/configure/app/output/source-map.mdx +38 -0
- package/docs/zh/configure/app/output/split-route-chunks.mdx +20 -0
- package/docs/zh/configure/app/output/ssg.mdx +84 -0
- package/docs/zh/configure/app/output/ssgByEntries.mdx +94 -0
- package/docs/zh/configure/app/output/svg-default-export.mdx +34 -0
- package/docs/zh/configure/app/output/temp-dir.mdx +22 -0
- package/docs/zh/configure/app/performance/build-cache.mdx +43 -0
- package/docs/zh/configure/app/performance/chunk-split.mdx +44 -0
- package/docs/zh/configure/app/performance/dns-prefetch.mdx +19 -0
- package/docs/zh/configure/app/performance/preconnect.mdx +20 -0
- package/docs/zh/configure/app/performance/prefetch.mdx +25 -0
- package/docs/zh/configure/app/performance/preload.mdx +27 -0
- package/docs/zh/configure/app/performance/print-file-size.mdx +44 -0
- package/docs/zh/configure/app/performance/profile.mdx +14 -0
- package/docs/zh/configure/app/performance/remove-console.mdx +14 -0
- package/docs/zh/configure/app/performance/remove-moment-locale.mdx +14 -0
- package/docs/zh/configure/app/performance/rsdoctor.mdx +39 -0
- package/docs/zh/configure/app/plugins.mdx +59 -0
- package/docs/zh/configure/app/resolve/alias-strategy.mdx +14 -0
- package/docs/zh/configure/app/resolve/alias.mdx +13 -0
- package/docs/zh/configure/app/resolve/condition-names.mdx +18 -0
- package/docs/zh/configure/app/resolve/dedupe.mdx +14 -0
- package/docs/zh/configure/app/resolve/extensions.mdx +18 -0
- package/docs/zh/configure/app/runtime/0-intro.mdx +58 -0
- package/docs/zh/configure/app/runtime/plugins.mdx +58 -0
- package/docs/zh/configure/app/runtime/router.mdx +39 -0
- package/docs/zh/configure/app/security/check-syntax.mdx +73 -0
- package/docs/zh/configure/app/security/nonce.mdx +19 -0
- package/docs/zh/configure/app/security/sri.mdx +24 -0
- package/docs/zh/configure/app/server/base-url.mdx +30 -0
- package/docs/zh/configure/app/server/port.mdx +23 -0
- package/docs/zh/configure/app/server/public-routes.mdx +26 -0
- package/docs/zh/configure/app/server/routes.mdx +90 -0
- package/docs/zh/configure/app/server/rsc.mdx +30 -0
- package/docs/zh/configure/app/server/ssr-by-entries.mdx +29 -0
- package/docs/zh/configure/app/server/ssr.mdx +85 -0
- package/docs/zh/configure/app/server/tsconfig-path.mdx +63 -0
- package/docs/zh/configure/app/source/alias-strategy.mdx +18 -0
- package/docs/zh/configure/app/source/alias.mdx +27 -0
- package/docs/zh/configure/app/source/config-dir.mdx +24 -0
- package/docs/zh/configure/app/source/decorators.mdx +27 -0
- package/docs/zh/configure/app/source/define.mdx +20 -0
- package/docs/zh/configure/app/source/disable-default-entries.mdx +32 -0
- package/docs/zh/configure/app/source/enable-async-entry.mdx +54 -0
- package/docs/zh/configure/app/source/enable-async-pre-entry.mdx +77 -0
- package/docs/zh/configure/app/source/entries-dir.mdx +39 -0
- package/docs/zh/configure/app/source/entries.mdx +185 -0
- package/docs/zh/configure/app/source/exclude.mdx +14 -0
- package/docs/zh/configure/app/source/global-vars.mdx +109 -0
- package/docs/zh/configure/app/source/include.mdx +40 -0
- package/docs/zh/configure/app/source/main-entry-name.mdx +28 -0
- package/docs/zh/configure/app/source/pre-entry.mdx +14 -0
- package/docs/zh/configure/app/source/transform-import.mdx +31 -0
- package/docs/zh/configure/app/split-chunks.mdx +17 -0
- package/docs/zh/configure/app/tools/autoprefixer.mdx +48 -0
- package/docs/zh/configure/app/tools/bundler-chain.mdx +33 -0
- package/docs/zh/configure/app/tools/css-extract.mdx +34 -0
- package/docs/zh/configure/app/tools/css-loader.mdx +21 -0
- package/docs/zh/configure/app/tools/dev-server.mdx +117 -0
- package/docs/zh/configure/app/tools/html-plugin.mdx +45 -0
- package/docs/zh/configure/app/tools/less.mdx +86 -0
- package/docs/zh/configure/app/tools/lightningcss-loader.mdx +39 -0
- package/docs/zh/configure/app/tools/minify-css.mdx +57 -0
- package/docs/zh/configure/app/tools/postcss.mdx +39 -0
- package/docs/zh/configure/app/tools/rspack.mdx +14 -0
- package/docs/zh/configure/app/tools/sass.mdx +80 -0
- package/docs/zh/configure/app/tools/style-loader.mdx +14 -0
- package/docs/zh/configure/app/tools/swc.mdx +69 -0
- package/docs/zh/configure/app/tools/ts-checker.mdx +56 -0
- package/docs/zh/configure/app/usage.mdx +276 -0
- package/docs/zh/guides/_meta.json +37 -0
- package/docs/zh/guides/advanced-features/_meta.json +32 -0
- package/docs/zh/guides/advanced-features/bff/_meta.json +10 -0
- package/docs/zh/guides/advanced-features/bff/cross-project.mdx +112 -0
- package/docs/zh/guides/advanced-features/bff/data-platform.mdx +118 -0
- package/docs/zh/guides/advanced-features/bff/extend-server.mdx +125 -0
- package/docs/zh/guides/advanced-features/bff/frameworks.mdx +118 -0
- package/docs/zh/guides/advanced-features/bff/function.mdx +262 -0
- package/docs/zh/guides/advanced-features/bff/operators.mdx +629 -0
- package/docs/zh/guides/advanced-features/bff/sdk.mdx +117 -0
- package/docs/zh/guides/advanced-features/bff/upload.mdx +7 -0
- package/docs/zh/guides/advanced-features/bff.mdx +21 -0
- package/docs/zh/guides/advanced-features/build-performance.mdx +134 -0
- package/docs/zh/guides/advanced-features/compatibility.mdx +80 -0
- package/docs/zh/guides/advanced-features/international/_meta.json +10 -0
- package/docs/zh/guides/advanced-features/international/advanced.mdx +132 -0
- package/docs/zh/guides/advanced-features/international/api.mdx +234 -0
- package/docs/zh/guides/advanced-features/international/best-practices.mdx +290 -0
- package/docs/zh/guides/advanced-features/international/configuration.mdx +219 -0
- package/docs/zh/guides/advanced-features/international/locale-detection.mdx +130 -0
- package/docs/zh/guides/advanced-features/international/quick-start.mdx +112 -0
- package/docs/zh/guides/advanced-features/international/resource-loading.mdx +155 -0
- package/docs/zh/guides/advanced-features/international/routing.mdx +134 -0
- package/docs/zh/guides/advanced-features/international.mdx +29 -0
- package/docs/zh/guides/advanced-features/low-level.mdx +48 -0
- package/docs/zh/guides/advanced-features/page-performance/_meta.json +1 -0
- package/docs/zh/guides/advanced-features/page-performance/code-split.mdx +81 -0
- package/docs/zh/guides/advanced-features/page-performance/inline-assets.mdx +162 -0
- package/docs/zh/guides/advanced-features/page-performance/optimize-bundle.mdx +101 -0
- package/docs/zh/guides/advanced-features/page-performance/react-compiler.mdx +54 -0
- package/docs/zh/guides/advanced-features/server-monitor/_meta.json +1 -0
- package/docs/zh/guides/advanced-features/server-monitor/logger.mdx +21 -0
- package/docs/zh/guides/advanced-features/server-monitor/metrics.mdx +42 -0
- package/docs/zh/guides/advanced-features/server-monitor/monitors.mdx +240 -0
- package/docs/zh/guides/advanced-features/source-build.mdx +168 -0
- package/docs/zh/guides/advanced-features/web-server.mdx +281 -0
- package/docs/zh/guides/basic-features/_meta.json +49 -0
- package/docs/zh/guides/basic-features/alias.mdx +100 -0
- package/docs/zh/guides/basic-features/css/_meta.json +1 -0
- package/docs/zh/guides/basic-features/css/css-in-js.mdx +69 -0
- package/docs/zh/guides/basic-features/css/css-modules.mdx +218 -0
- package/docs/zh/guides/basic-features/css/css.mdx +31 -0
- package/docs/zh/guides/basic-features/css/tailwindcss.mdx +27 -0
- package/docs/zh/guides/basic-features/data/_meta.json +1 -0
- package/docs/zh/guides/basic-features/data/data-cache.mdx +498 -0
- package/docs/zh/guides/basic-features/data/data-fetch.mdx +421 -0
- package/docs/zh/guides/basic-features/data/data-write.mdx +234 -0
- package/docs/zh/guides/basic-features/debug/_meta.json +1 -0
- package/docs/zh/guides/basic-features/debug/mock.mdx +102 -0
- package/docs/zh/guides/basic-features/debug/proxy.mdx +25 -0
- package/docs/zh/guides/basic-features/debug/rsdoctor.mdx +48 -0
- package/docs/zh/guides/basic-features/debug/using-storybook.mdx +92 -0
- package/docs/zh/guides/basic-features/deploy.mdx +432 -0
- package/docs/zh/guides/basic-features/env-vars.mdx +180 -0
- package/docs/zh/guides/basic-features/html.mdx +262 -0
- package/docs/zh/guides/basic-features/output-files.mdx +145 -0
- package/docs/zh/guides/basic-features/render/_meta.json +10 -0
- package/docs/zh/guides/basic-features/render/before-render.mdx +108 -0
- package/docs/zh/guides/basic-features/render/overview.mdx +53 -0
- package/docs/zh/guides/basic-features/render/rsc.mdx +619 -0
- package/docs/zh/guides/basic-features/render/ssg.mdx +168 -0
- package/docs/zh/guides/basic-features/render/ssr-cache.mdx +205 -0
- package/docs/zh/guides/basic-features/render/ssr.mdx +334 -0
- package/docs/zh/guides/basic-features/render/streaming-ssr.mdx +276 -0
- package/docs/zh/guides/basic-features/render/tanstack-rsc.mdx +226 -0
- package/docs/zh/guides/basic-features/routes/_meta.json +1 -0
- package/docs/zh/guides/basic-features/routes/config-routes.mdx +426 -0
- package/docs/zh/guides/basic-features/routes/routes.mdx +521 -0
- package/docs/zh/guides/basic-features/static-assets/_meta.json +1 -0
- package/docs/zh/guides/basic-features/static-assets/json-files.mdx +124 -0
- package/docs/zh/guides/basic-features/static-assets/svg-assets.mdx +174 -0
- package/docs/zh/guides/basic-features/static-assets/wasm-assets.mdx +66 -0
- package/docs/zh/guides/basic-features/static-assets.mdx +160 -0
- package/docs/zh/guides/basic-features/testing/_meta.json +1 -0
- package/docs/zh/guides/basic-features/testing/cypress.mdx +95 -0
- package/docs/zh/guides/basic-features/testing/jest.mdx +148 -0
- package/docs/zh/guides/basic-features/testing/playwright.mdx +112 -0
- package/docs/zh/guides/basic-features/testing/rstest.mdx +163 -0
- package/docs/zh/guides/basic-features/testing/vitest.mdx +100 -0
- package/docs/zh/guides/concept/_meta.json +1 -0
- package/docs/zh/guides/concept/builder.mdx +60 -0
- package/docs/zh/guides/concept/entries.mdx +323 -0
- package/docs/zh/guides/concept/server.mdx +35 -0
- package/docs/zh/guides/get-started/_meta.json +8 -0
- package/docs/zh/guides/get-started/glossary.mdx +63 -0
- package/docs/zh/guides/get-started/introduction.mdx +45 -0
- package/docs/zh/guides/get-started/quick-start.mdx +90 -0
- package/docs/zh/guides/get-started/tech-stack.mdx +91 -0
- package/docs/zh/guides/get-started/ultramodern.mdx +80 -0
- package/docs/zh/guides/get-started/upgrade.mdx +114 -0
- package/docs/zh/guides/topic-detail/_meta.json +8 -0
- package/docs/zh/guides/topic-detail/module-federation/_meta.json +1 -0
- package/docs/zh/guides/topic-detail/module-federation/application.mdx +117 -0
- package/docs/zh/guides/topic-detail/module-federation/deploy.mdx +104 -0
- package/docs/zh/guides/topic-detail/module-federation/i18n.mdx +623 -0
- package/docs/zh/guides/topic-detail/module-federation/introduce.mdx +35 -0
- package/docs/zh/guides/topic-detail/module-federation/ssr.mdx +168 -0
- package/docs/zh/guides/topic-detail/module-federation/usage.mdx +200 -0
- package/docs/zh/guides/troubleshooting/_meta.json +1 -0
- package/docs/zh/guides/troubleshooting/builder.mdx +134 -0
- package/docs/zh/guides/troubleshooting/cli.mdx +39 -0
- package/docs/zh/guides/troubleshooting/dependencies.mdx +123 -0
- package/docs/zh/guides/troubleshooting/hmr.mdx +148 -0
- package/docs/zh/guides/upgrade/_meta.json +1 -0
- package/docs/zh/guides/upgrade/config.mdx +953 -0
- package/docs/zh/guides/upgrade/entry.mdx +463 -0
- package/docs/zh/guides/upgrade/other.md +190 -0
- package/docs/zh/guides/upgrade/overview.mdx +36 -0
- package/docs/zh/guides/upgrade/tailwindcss.mdx +92 -0
- package/docs/zh/guides/upgrade/web-server.md +111 -0
- package/docs/zh/index.md +4 -0
- package/docs/zh/plugin/_meta.json +25 -0
- package/docs/zh/plugin/cli-plugins/_meta.json +1 -0
- package/docs/zh/plugin/cli-plugins/api.mdx +569 -0
- package/docs/zh/plugin/cli-plugins/life-cycle.mdx +135 -0
- package/docs/zh/plugin/introduction.mdx +153 -0
- package/docs/zh/plugin/official/_meta.json +7 -0
- package/docs/zh/plugin/official/cli-plugins/_meta.json +1 -0
- package/docs/zh/plugin/official/cli-plugins/plugin-bff.mdx +5 -0
- package/docs/zh/plugin/official/cli-plugins/plugin-ssg.mdx +5 -0
- package/docs/zh/plugin/official/cli-plugins/plugin-styled-components.mdx +5 -0
- package/docs/zh/plugin/official/cli-plugins.mdx +4 -0
- package/docs/zh/plugin/plugin-system.mdx +231 -0
- package/docs/zh/plugin/runtime-plugins/_meta.json +1 -0
- package/docs/zh/plugin/runtime-plugins/api.mdx +193 -0
- package/docs/zh/plugin/runtime-plugins/life-cycle.mdx +29 -0
- package/docs/zh/plugin/server-plugins/_meta.json +1 -0
- package/docs/zh/plugin/server-plugins/api.mdx +212 -0
- package/docs/zh/plugin/server-plugins/life-cycle.mdx +43 -0
- package/docs/zh/tutorials/_meta.json +7 -0
- package/docs/zh/tutorials/examples/csr-auth.mdx +31 -0
- package/docs/zh/tutorials/foundations/introduction.mdx +22 -0
- package/i18n.json +142 -0
- package/main-doc/docs/en/guides/get-started/ultramodern.mdx +320 -0
- package/main-doc/docs/zh/guides/get-started/ultramodern.mdx +304 -0
- package/package.json +52 -0
- package/rspress.config.ts +153 -0
- package/src/components/ContentCard/index.module.scss +65 -0
- package/src/components/ContentCard/index.tsx +24 -0
- package/src/components/FeatureLayout/index.module.css +8 -0
- package/src/components/FeatureLayout/index.tsx +8 -0
- package/src/components/Footer/index.tsx +118 -0
- package/src/components/Footer/styles.module.scss +49 -0
- package/src/components/FrameworkCode/index.tsx +605 -0
- package/src/components/ListCard/index.module.css +57 -0
- package/src/components/ListCard/index.tsx +26 -0
- package/src/components/Mermaid/index.tsx +64 -0
- package/src/components/Mermaid/style.scss +221 -0
- package/src/components/RandomMemberList/index.module.scss +35 -0
- package/src/components/RandomMemberList/index.tsx +122 -0
- package/src/components/RsbuildLink/index.tsx +19 -0
- package/src/components/Sandpack/index.css +10 -0
- package/src/components/Sandpack/index.tsx +22 -0
- package/src/components/SecondaryTitle/index.module.css +14 -0
- package/src/components/SecondaryTitle/index.tsx +15 -0
- package/src/components/ShowcaseList/index.module.scss +80 -0
- package/src/components/ShowcaseList/index.tsx +39 -0
- package/src/components/ShowcaseList/useShowcases.ts +101 -0
- package/src/components/SolutionCards/index.module.scss +73 -0
- package/src/components/SolutionCards/index.tsx +30 -0
- package/src/custom.scss +15 -0
- package/src/global.d.ts +28 -0
- package/src/i18n/enUS.ts +54 -0
- package/src/i18n/index.ts +18 -0
- package/src/i18n/zhCN.ts +54 -0
- package/src/index.ts +5 -0
- package/src/pages/index.module.scss +349 -0
- package/src/pages/index.tsx +133 -0
- package/src/sandbox/csr-auth/src/routes/Auth-tsx.txt +74 -0
- package/src/sandbox/csr-auth/src/routes/fakeAuth-ts.txt +16 -0
- package/src/sandbox/csr-auth/src/routes/layout-tsx.txt +21 -0
- package/src/sandbox/csr-auth/src/routes/login/page-tsx.txt +40 -0
- package/src/sandbox/csr-auth/src/routes/page-tsx.txt +17 -0
- package/src/sandbox/csr-auth/src/routes/protected/page-tsx.txt +11 -0
- package/static/img/favicon.ico +0 -0
- package/static/img/features/ai.svg +1 -0
- package/static/img/features/api.svg +1 -0
- package/static/img/features/app.svg +1 -0
- package/static/img/features/blocks.svg +1 -0
- package/static/img/features/browser.svg +12 -0
- package/static/img/features/cloud.svg +1 -0
- package/static/img/features/coding-backend.svg +1 -0
- package/static/img/features/compiler.svg +1 -0
- package/static/img/features/css-file.svg +1 -0
- package/static/img/features/customize.svg +1 -0
- package/static/img/features/developer.svg +1 -0
- package/static/img/features/dynamic.svg +1 -0
- package/static/img/features/editor.svg +1 -0
- package/static/img/features/framework-config.svg +1 -0
- package/static/img/features/framework.svg +1 -0
- package/static/img/features/frameworks.svg +1 -0
- package/static/img/features/html.svg +1 -0
- package/static/img/features/icon2.svg +1 -0
- package/static/img/features/javascript.svg +1 -0
- package/static/img/features/monorepo.svg +1 -0
- package/static/img/features/product.svg +1 -0
- package/static/img/features/server-network.svg +1 -0
- package/static/img/features/serverless.svg +1 -0
- package/static/img/features/test.svg +1 -0
- package/static/img/features/trinity.svg +1 -0
- package/static/img/features/unity.svg +1 -0
- package/static/img/features/url.svg +1 -0
- package/static/img/features/visual.svg +1 -0
- package/static/img/features/web-server.svg +1 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 15
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Deploy Application
|
|
6
|
+
|
|
7
|
+
Currently, Modern.js offers two deployment way:
|
|
8
|
+
|
|
9
|
+
- You can host your application in a container that includes a Node.js environment on your own, which provides flexibility for the deployment of the application.
|
|
10
|
+
- You can also deploy your application through a platform. Currently, Modern.js officially supports deployment on [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), and [Github pages](https://pages.github.com/).
|
|
11
|
+
|
|
12
|
+
:::info
|
|
13
|
+
Currently, Modern.js only supports running in a Node.js environment. Support for more runtime environments will be provided in the future.
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
## Build Deployment Products
|
|
17
|
+
|
|
18
|
+
Running the `modern deploy` command will automatically produce deployment products. This process includes optimizing Bundler build products and their dependencies, detecting the current deployment platform, and automatically generating deployment products that can run on that platform.
|
|
19
|
+
|
|
20
|
+
If you want to generate and test the output locally for a specific deployment platform, you can specify the platform by setting the environment variable: `modern deploy`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
MODERNJS_DEPLOY=netlify npx modern deploy
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
:::info
|
|
27
|
+
When deploying on the deployment platforms officially supported by Modern.js, there is no need to specify environment variables.
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## Using ModernJS built-in Node.js Server
|
|
31
|
+
|
|
32
|
+
### Single Repo
|
|
33
|
+
|
|
34
|
+
By default, Modern.js outputs builds that can be run in a Node.js environment when no Modern.js-supported deployment platform is detected.
|
|
35
|
+
|
|
36
|
+
Use the following command to build the project:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx modern deploy
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
When running the `modern deploy` command, Modern.js will generate runnable products and output the following content in terminal:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
Static directory: `.output/static`
|
|
46
|
+
You can preview this build by `node .output/index`
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
At this point, you can run the entire server by `node .output/index`, and the static resources required for the page are in the `.output/static` directory. You can upload these static resources to a CDN yourself:
|
|
50
|
+
|
|
51
|
+
:::info
|
|
52
|
+
By default, when running Modern.js Server, it listens on port 8080. If you want to change the listening port, you can specify the `PORT` environment variable:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
PORT=3000 node .output/index
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
:::
|
|
59
|
+
|
|
60
|
+
### Monorepo
|
|
61
|
+
|
|
62
|
+
For Monorepo projects, in addition to building the current project, it is also necessary to build other sub-projects in the repository that the current project depends on.
|
|
63
|
+
|
|
64
|
+
Assume that the name in the `package.json` of the current project is `app`. Taking pnpm as an example of a monorepo management tool, you can add the following command to the `package.json` of the current project to build products for the current project:
|
|
65
|
+
|
|
66
|
+
```json title="app/package.json"
|
|
67
|
+
{
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build:packages": "pnpm --filter 'app^...' run build",
|
|
70
|
+
"deploy": "pnpm run build:packages && modern deploy"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If you use Rush as your Monorepo management tool, you can add the following commands to your `package.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build:packages": "rush rebuild --to-except app",
|
|
81
|
+
"deploy": "rushx build:packages && modern deploy"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
After the build is completed, Modern.js will generate all dependencies in the `.output/node_modules` directory of the project. Similarly, you can run the Modern.js server using `node .output/index`.
|
|
87
|
+
|
|
88
|
+
## Netlify
|
|
89
|
+
|
|
90
|
+
Netlify is a popular Web development platform designed for building, deploying, and maintaining modern web projects. Deploying on Netlify mainly requires configuring the `netlify.toml` file.
|
|
91
|
+
|
|
92
|
+
Depending on the complexity of your project, you can configure it incrementally by this doc.
|
|
93
|
+
|
|
94
|
+
### Pure Front-end Project
|
|
95
|
+
|
|
96
|
+
Add the `netlify.toml` file to the root directory of the current project:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
.
|
|
100
|
+
├── src
|
|
101
|
+
├── modern.config.ts
|
|
102
|
+
├── netlify.toml
|
|
103
|
+
└── package.json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Add the following content to `netlify.toml`:
|
|
107
|
+
|
|
108
|
+
```toml
|
|
109
|
+
[build]
|
|
110
|
+
publish = "dist"
|
|
111
|
+
command = "modern deploy"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
:::info
|
|
115
|
+
You can refer to the [deployment project example](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-csr).
|
|
116
|
+
|
|
117
|
+
:::
|
|
118
|
+
|
|
119
|
+
Now, add a project to the Netlify platform and deploy it!
|
|
120
|
+
|
|
121
|
+
### Full Stack Project
|
|
122
|
+
|
|
123
|
+
Full-stack projects refer to projects that use Custom Web Server, SSR or BFF. These projects need to be deployed on **Netlify Functions**. Based on the `netlify.toml` file mentioned above, add the following configuration:
|
|
124
|
+
|
|
125
|
+
```toml title="netlify.toml"
|
|
126
|
+
[build]
|
|
127
|
+
publish = "dist"
|
|
128
|
+
command = "modern deploy"
|
|
129
|
+
|
|
130
|
+
[functions]
|
|
131
|
+
directory = ".netlify/functions"
|
|
132
|
+
node_bundler = "none"
|
|
133
|
+
included_files = [".netlify/functions/**"]
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
:::info
|
|
138
|
+
|
|
139
|
+
1. Currently, Modern.js does not support deployment on Netlify Edge Functions. We will support it in future versions.
|
|
140
|
+
2. You can refer to the [deployment project example](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-ssr).
|
|
141
|
+
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
### Monorepo
|
|
145
|
+
|
|
146
|
+
:::info
|
|
147
|
+
The following guide is mainly for full-stack projects, for pure CSR projects, just follow [Pure Frontend Project](#pure-front-end-project-1) to deploy.
|
|
148
|
+
:::
|
|
149
|
+
|
|
150
|
+
For Monorepo projects, in addition to building our current project, you also need to build other sub-projects in the repository that the current project depends on.
|
|
151
|
+
|
|
152
|
+
We take a pnpm Monorepo repository as an example and deploy the Monorepo project on Netlify.
|
|
153
|
+
|
|
154
|
+
Assuming the directory structure of the Monorepo repository is as follows:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
.
|
|
158
|
+
├── packages
|
|
159
|
+
│ ├── app
|
|
160
|
+
│ └── app-dep1
|
|
161
|
+
├── package.json
|
|
162
|
+
├── pnpm-lock.yaml
|
|
163
|
+
└── pnpm-workspace.yaml
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
You need to configure Base directory on the netlify platform as `packages/app`:
|
|
167
|
+
|
|
168
|
+
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/netlify-monorepo-basedir.png?x-resource-account=public" />
|
|
169
|
+
|
|
170
|
+
Add the following script in `packages/app/package.json`, before executing the deployment command of the `app` repository, first execute the build of other repositories in the workspace:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"scripts": {
|
|
175
|
+
"build:packages": "pnpm --filter 'app^...' run build",
|
|
176
|
+
"deploy": "pnpm run build:packages && modern deploy"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Configure the build command in `netlify.toml`:
|
|
182
|
+
|
|
183
|
+
```toml
|
|
184
|
+
[build]
|
|
185
|
+
publish = "dist"
|
|
186
|
+
command = "npm run deploy"
|
|
187
|
+
|
|
188
|
+
[functions]
|
|
189
|
+
directory = ".netlify/functions"
|
|
190
|
+
node_bundler = "none"
|
|
191
|
+
included_files = [".netlify/functions/**"]
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Just submit your code and deploy it using the Netlify platform.
|
|
195
|
+
|
|
196
|
+
## Vercel
|
|
197
|
+
|
|
198
|
+
Vercel is a deployment platform for modern web applications that provides a rich set of features to support deploying static websites, server-side rendered applications, and more. To deploy on Vercel, you usually need to configure the `vercel.json` file, which you can configure incrementally depending on the complexity of your project.
|
|
199
|
+
|
|
200
|
+
### Pure Front-end Project
|
|
201
|
+
|
|
202
|
+
Add the `vercel.json` file to the root directory of the current project:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
./
|
|
206
|
+
├── src
|
|
207
|
+
├── modern.config.ts
|
|
208
|
+
├── vercel.json
|
|
209
|
+
└── package.json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Add the following content to `vercel.json`:
|
|
213
|
+
|
|
214
|
+
```json title="vercel.json"
|
|
215
|
+
{
|
|
216
|
+
"buildCommand": "modern deploy",
|
|
217
|
+
"outputDirectory": ".vercel/output"
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Commit your project to git, select Framework Preset as `Other` on the Vercel platform and deploy.
|
|
222
|
+
|
|
223
|
+
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-framework-preset.png" />
|
|
224
|
+
|
|
225
|
+
:::info
|
|
226
|
+
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-csr).
|
|
227
|
+
|
|
228
|
+
:::
|
|
229
|
+
|
|
230
|
+
### Full Stack Project
|
|
231
|
+
|
|
232
|
+
Full-stack projects refer to projects that use Custom Web Server, SSR or BFF. These projects need to be deployed on **Vercel Functions**.
|
|
233
|
+
|
|
234
|
+
In addition to configuring `vercel.json` in the same way as a [pure front-end project](#pure-front-end-project), there are two points to note for full-stack projects:
|
|
235
|
+
|
|
236
|
+
1. Currently, Modern.js does not support deploying BFF projects on the Vercel platform. We will support it in future versions.
|
|
237
|
+
2. The Node.js version for function execution is determined by the project configuration on the Vercel platform.
|
|
238
|
+
|
|
239
|
+
:::info
|
|
240
|
+
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-ssr).
|
|
241
|
+
|
|
242
|
+
:::
|
|
243
|
+
|
|
244
|
+
### Monorepo
|
|
245
|
+
|
|
246
|
+
:::info
|
|
247
|
+
The following guide is mainly for full-stack projects, for pure CSR projects, just follow [Pure Frontend Project](#pure-front-end-project-1) to deploy.
|
|
248
|
+
:::
|
|
249
|
+
|
|
250
|
+
For Monorepo projects, in addition to building our current project, you also need to build other sub-projects in the repository that the current project depends on.
|
|
251
|
+
|
|
252
|
+
We take a pnpm Monorepo repository as an example and deploy the Monorepo project on Vercel.
|
|
253
|
+
|
|
254
|
+
Assuming the directory structure of the Monorepo repository is as follows:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
.
|
|
258
|
+
├── packages
|
|
259
|
+
│ ├── app
|
|
260
|
+
│ └── app-dep1
|
|
261
|
+
├── package.json
|
|
262
|
+
├── pnpm-lock.yaml
|
|
263
|
+
└── pnpm-workspace.yaml
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
First, you need to configure the **Root Directory** as `packages/app` on the Vercel platform:
|
|
267
|
+
|
|
268
|
+
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-root-directory.png" />
|
|
269
|
+
|
|
270
|
+
Specify Node.js runtime as `20.x`:
|
|
271
|
+
|
|
272
|
+
```json title="package.json"
|
|
273
|
+
"engines": {
|
|
274
|
+
"node": "20.x"
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Add the following script to `packages/app/package.json` to run `build` command of the other repositories in the workspace before run the `deploy` command for the `app` repository:
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"scripts": {
|
|
283
|
+
"build:packages": "pnpm --filter 'app^...' run build",
|
|
284
|
+
"deploy": "pnpm run build:packages && modern deploy"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Add the following content to the `packages/app/vercel.json` file:
|
|
290
|
+
|
|
291
|
+
```json title="vercel.json"
|
|
292
|
+
{
|
|
293
|
+
"buildCommand": "npm run deploy",
|
|
294
|
+
"outputDirectory": ".vercel/output"
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Just submit your code and deploy it using the Vercel platform.
|
|
299
|
+
|
|
300
|
+
## Github Pages
|
|
301
|
+
|
|
302
|
+
If you're creating a GitHub Pages for a repository without a custom domain, the page URL will follow this format: `http://<username>.github.io/<repository-name>`. Therefore, you need to add the following configuration in `modern.config.ts`:
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
import { defineConfig } from '@modern-js/app-tools';
|
|
306
|
+
|
|
307
|
+
export default defineConfig({
|
|
308
|
+
//...
|
|
309
|
+
server: {
|
|
310
|
+
baseUrl: '/<repository-name>',
|
|
311
|
+
},
|
|
312
|
+
output: {
|
|
313
|
+
assetPrefix: '/<repository-name>',
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
GitHub Pages supports two deployment ways: branch deployment or GitHub Actions deployment.
|
|
319
|
+
|
|
320
|
+
For branch deployment, follow these steps:
|
|
321
|
+
|
|
322
|
+
1. In the GitHub repository, navigate to Settings > Pages > Source > Deploy from a branch
|
|
323
|
+
2. Install the `gh-pages` as devDependency
|
|
324
|
+
3. Add the following script to `package.json`
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
"scripts": {
|
|
328
|
+
//...
|
|
329
|
+
"deploy:gh-pages": "MODERNJS_DEPLOY=ghPages modern deploy && gh-pages -d .output"
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
4. Run `npm run deploy:gh-pages`
|
|
334
|
+
|
|
335
|
+
:::info
|
|
336
|
+
|
|
337
|
+
1. Running `MODERNJS_DEPLOY=ghPages modern deploy` will build the production output for GitHub in the .output directory.
|
|
338
|
+
2. You can refer to the [project](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-csr)
|
|
339
|
+
:::
|
|
340
|
+
|
|
341
|
+
For GitHub Actions deployment, select Settings > Pages > Source > GitHub Actions, and add a workflow file to the project. You can refer to the [example](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-csr).
|
|
342
|
+
|
|
343
|
+
## Using Self-Built Node.js Server
|
|
344
|
+
|
|
345
|
+
Typically, we recommend using the built-in Node.js server of Modern.js to deploy applications. It supports hosting both pure frontend and full-stack projects, ensuring consistent performance in both development and production environments.
|
|
346
|
+
|
|
347
|
+
If your project is purely frontend, you can also deploy the application to the self-built Node.js server. Below is an example of using a Koa server to host the output of a pure frontend project.
|
|
348
|
+
|
|
349
|
+
For instance, if you have a Node.js server repository, you can copy the output of the project into this repository. The structure would look like this:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
.
|
|
353
|
+
├── .output
|
|
354
|
+
│ ├── html
|
|
355
|
+
│ └── static
|
|
356
|
+
└── server.js
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
In `server.js`, assume you have the following code:
|
|
360
|
+
|
|
361
|
+
```ts title="server.js"
|
|
362
|
+
import Koa from 'koa';
|
|
363
|
+
|
|
364
|
+
const app = new Koa();
|
|
365
|
+
app.use(async (ctx, next) => {
|
|
366
|
+
ctx.body = 'Hello Modern.js';
|
|
367
|
+
});
|
|
368
|
+
app.listen(3000);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Now, you can add some code to include the logic for accessing static resources and HTML files in `server.js`. We need to use the `mime-types` package to get the MIME types of static resources, so let's install the dependency first:
|
|
372
|
+
|
|
373
|
+
import { PackageManagerTabs } from '@theme';
|
|
374
|
+
|
|
375
|
+
<PackageManagerTabs command="add mime-types" />
|
|
376
|
+
|
|
377
|
+
```ts title="server.js"
|
|
378
|
+
const Koa = require('koa');
|
|
379
|
+
const fs = require('fs');
|
|
380
|
+
const path = require('path');
|
|
381
|
+
const mime = require('mime-types');
|
|
382
|
+
|
|
383
|
+
const app = new Koa();
|
|
384
|
+
app.use(async (ctx, next) => {
|
|
385
|
+
if (ctx.path.startsWith('/static')) {
|
|
386
|
+
ctx.type = mime.lookup(ctx.path);
|
|
387
|
+
ctx.body = fs.createReadStream(
|
|
388
|
+
path.resolve(__dirname, `.output${ctx.path}`),
|
|
389
|
+
);
|
|
390
|
+
} else if (ctx.path === '/') {
|
|
391
|
+
ctx.type = 'html';
|
|
392
|
+
ctx.body = fs.createReadStream(
|
|
393
|
+
path.resolve(__dirname, '.output/html/main/index.html'),
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
app.listen(3000);
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
:::note
|
|
401
|
+
The above code is a basic example. Your application might have multiple entry points and require different HTML files for different paths. A custom Node.js server would also involve more complex logic.
|
|
402
|
+
|
|
403
|
+
Please note that if your project uses Modern.js conventional routing or if you have set up client-side routing with React Router, you must access HTML files through the correct `baseURL`.
|
|
404
|
+
|
|
405
|
+
In Modern.js, the default `baseURL` is `'/'`. You can configure it by modifying [`server.baseUrl`](/configure/app/server/base-url) in `modern.config.ts`.
|
|
406
|
+
|
|
407
|
+
:::danger
|
|
408
|
+
For projects with client-side routing, you can never access HTML files through the `/index.html` path.
|
|
409
|
+
:::
|
|
410
|
+
|
|
411
|
+
## Nginx
|
|
412
|
+
|
|
413
|
+
Nginx is a high-performance HTTP and reverse proxy server that can handle static files, reverse proxy, load balancing, and other functions. Deploying on Nginx typically requires configuring the `nginx.conf` file.
|
|
414
|
+
|
|
415
|
+
If your project is a purely front-end project, you can also deploy the application through Nginx. Here is an example of an Nginx configuration to demonstrate how to host the output of a purely front-end project.
|
|
416
|
+
|
|
417
|
+
```nginx title="nginx.conf"
|
|
418
|
+
# user [user] [group];
|
|
419
|
+
worker_processes 1;
|
|
420
|
+
|
|
421
|
+
events {
|
|
422
|
+
worker_connections 1024;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
http {
|
|
426
|
+
include mime.types;
|
|
427
|
+
default_type application/octet-stream;
|
|
428
|
+
|
|
429
|
+
server {
|
|
430
|
+
listen 8080;
|
|
431
|
+
server_name localhost;
|
|
432
|
+
|
|
433
|
+
location / {
|
|
434
|
+
# root [projectPath]/.output/html/main;
|
|
435
|
+
index index.html;
|
|
436
|
+
try_files $uri $uri/ =404;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
location /static {
|
|
440
|
+
# alias [projectPath]/.output/static;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
In the above configuration, you need to replace `[projectPath]` with your project path and `[user]` and `[group]` with your current user and user group.
|
|
447
|
+
|
|
448
|
+
You can copy the above configuration into the `nginx.conf` file in the Nginx installation directory and then start the Nginx service. You can also start the configuration file in a specified path using `nginx -c`, in which case you need to ensure that the path configured in the `include` directive is correct.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 7
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Environment Variables
|
|
6
|
+
|
|
7
|
+
Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
|
|
8
|
+
|
|
9
|
+
## Built-in Environment Variables
|
|
10
|
+
|
|
11
|
+
### ASSET_PREFIX
|
|
12
|
+
|
|
13
|
+
The current path prefix of the asset, which is a read-only environment variable.
|
|
14
|
+
|
|
15
|
+
### NODE_ENV
|
|
16
|
+
|
|
17
|
+
The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
|
|
18
|
+
|
|
19
|
+
- `production`: Default value when running `modern build` or `modern serve`.
|
|
20
|
+
- `development`: Default value when running `modern dev`, also the default value in other cases.
|
|
21
|
+
|
|
22
|
+
### MODERN_ENV
|
|
23
|
+
|
|
24
|
+
Set the current execution environment manually. In addition to the values in the NODE_ENV, custom environment names are supported here, such as `staging`, `boe`, etc.
|
|
25
|
+
|
|
26
|
+
:::tip
|
|
27
|
+
MODERN_ENV priority is higher than NODE_ENV.
|
|
28
|
+
|
|
29
|
+
:::
|
|
30
|
+
|
|
31
|
+
### MODERN_TARGET
|
|
32
|
+
|
|
33
|
+
When using `@modern-js/runtime`, Modern.js will automatically inject `MODERN_TARGET` to distinguish between SSR and CSR environments.
|
|
34
|
+
|
|
35
|
+
You can use `process.env.MODERN_TARGET` to determine the environment and execute appropriate code.
|
|
36
|
+
|
|
37
|
+
```ts title="App.tsx"
|
|
38
|
+
function App() {
|
|
39
|
+
if (process.env.MODERN_TARGET === 'browser') {
|
|
40
|
+
console.log(window.innerHeight);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
After the development build, you can see that the SSR and CSR bundles as follows:
|
|
46
|
+
|
|
47
|
+
```js title="dist/bundles/main.js"
|
|
48
|
+
// SSR bundles
|
|
49
|
+
function App() {
|
|
50
|
+
if (false) {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```js title="dist/static/main.js"
|
|
56
|
+
// CSR bundles
|
|
57
|
+
function App() {
|
|
58
|
+
if (true) {
|
|
59
|
+
console.log(window.innerHeight);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This can provide different outputs for different environments to ensure that the bundle size is minimized. It can also be convenient to deal with some side effects for different environments.
|
|
65
|
+
|
|
66
|
+
:::note Dead Code Elimination
|
|
67
|
+
In production environment, minimizers such as Terser and SWC will analyze the code and remove dead code to reduce the bundle size. This process is called "Dead Code Elimination" (DCE).
|
|
68
|
+
|
|
69
|
+
For example, the code inside the `if (false)` statement will be removed, while the code inside the `if (true)` will be preserved.
|
|
70
|
+
|
|
71
|
+
If you do not use `process.env.MODERN_TARGET` as described above, the code minimizer may not be able to analyze the dead code, resulting in an increased bundle size.
|
|
72
|
+
|
|
73
|
+
:::
|
|
74
|
+
|
|
75
|
+
## Custom Environment Variables
|
|
76
|
+
|
|
77
|
+
You can specify custom environment variables in both `shell` and `.env` files.
|
|
78
|
+
|
|
79
|
+
### Via `shell`
|
|
80
|
+
|
|
81
|
+
Add custom environment variables before the command:
|
|
82
|
+
|
|
83
|
+
```shell
|
|
84
|
+
REACT_APP_FOO=123 BAR=456 pnpm run dev
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Via `.env` file
|
|
88
|
+
|
|
89
|
+
Create a `.env` file in the project root and add custom environment variables, which are added to the Node.js process by default, for example:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
REACT_APP_FOO=123
|
|
93
|
+
BAR=456
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `.env` file follows the following loading rules:
|
|
97
|
+
|
|
98
|
+
- `.env`: default.
|
|
99
|
+
- `.env.{ MODERN_ENV | NODE_ENV }`: Overrides `.env` for a specific environment.
|
|
100
|
+
|
|
101
|
+
When you need to use different config according to the environment, you can define environment variables in the `.env` file corresponding to the environment name, and manually set the execution environment when starting the project.
|
|
102
|
+
|
|
103
|
+
For example, when starting a project with the following command, the `.env` and `.env.staging` will load:
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
MODERN_ENV=staging pnpm run dev
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Using Environment Variables
|
|
110
|
+
|
|
111
|
+
### Convention Names
|
|
112
|
+
|
|
113
|
+
`NODE_ENV` can be used directly in front-end code. In addition, custom environment variables starting with `MODERN_` can also be used directly in code.
|
|
114
|
+
|
|
115
|
+
For Example:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
if (process.env.NODE_ENV === 'development') {
|
|
119
|
+
// do something
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
After executing the `pnpm run dev`, you can see the following bundle:
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
if (true) {
|
|
127
|
+
// do something
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
In custom HTML templates, you can also use such environment variables directly. For example, in `config/html/head.html`:
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<meta name="test" content="<process.env.NODE_ENV>" />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Any Other Names
|
|
138
|
+
|
|
139
|
+
If you need to use environment variables with any other names in your code, you can configure them in [`source.globalVars`](/configure/app/source/global-vars). For example:
|
|
140
|
+
|
|
141
|
+
```ts title="modern.config.ts"
|
|
142
|
+
export default defineConfig({
|
|
143
|
+
source: {
|
|
144
|
+
globalVars: {
|
|
145
|
+
'process.env.VERSION': process.env.VERSION,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
At this point, the `process.env.VERSION` in the code will be replaced by the value of `VERSION` in the environment variables.
|
|
152
|
+
|
|
153
|
+
:::note
|
|
154
|
+
`source.globalVars` also supports replacing other expressions or strings with specified values, not limited to environment variables.
|
|
155
|
+
|
|
156
|
+
:::
|
|
157
|
+
|
|
158
|
+
## Use Global Replacement
|
|
159
|
+
|
|
160
|
+
In addition to environment variables, Modern.js also supports replacing variables in code with other values or expressions, which can be used to distinguish between development environment and production environment in code.
|
|
161
|
+
|
|
162
|
+
For example, converts the expression `TWO` to `1 + 1`:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
export default {
|
|
166
|
+
source: {
|
|
167
|
+
define: {
|
|
168
|
+
TWO: '1 + 1',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
const foo = TWO;
|
|
176
|
+
|
|
177
|
+
// ⬇️ Turn into being...
|
|
178
|
+
const foo = 1 + 1;
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
In most cases, `source.globalVars` is already sufficient to replace variables. But the values passed in by `source.globalVars` will be serialized by JSON by default. So it cannot be replaced like `1 + 1` in the example above, at this time, we need to use [`source.define`](/configure/app/source/define).
|