@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,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 11
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Import SVG Assets
|
|
6
|
+
|
|
7
|
+
Modern.js supports import SVG assets and transform SVG into React components or URLs.
|
|
8
|
+
|
|
9
|
+
:::tip What is SVG
|
|
10
|
+
SVG stands for Scalable Vector Graphics. It is a type of image format that uses vector graphics to represent images. Vector graphics are different from raster graphics, which are made up of pixels. Instead, vector graphics use geometric shapes, lines, and curves to represent images. Because vector graphics are not made up of pixels, they can be scaled to any size without losing resolution or quality.
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
## Import SVG in JS file
|
|
14
|
+
|
|
15
|
+
### Default Import
|
|
16
|
+
|
|
17
|
+
If you use the default import to reference SVG, it will be treated as a static asset and you will get a URL string:
|
|
18
|
+
|
|
19
|
+
```tsx title="src/component/Logo.tsx"
|
|
20
|
+
import logoURL from './static/logo.svg';
|
|
21
|
+
|
|
22
|
+
console.log(logoURL); // => "/static/logo.6c12aba3.png"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Transform to React Component
|
|
26
|
+
|
|
27
|
+
When referencing SVG assets in JS files, if the import path includes the `?react` suffix, Modern.js will call SVGR to transform the SVG image into a React component:
|
|
28
|
+
|
|
29
|
+
```tsx title="src/component/Logo.tsx"
|
|
30
|
+
import Logo from './logo.svg?react';
|
|
31
|
+
|
|
32
|
+
export default () => <Logo />;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Modern.js also supports the following usage, transforming SVG into a React component by named import `ReactComponent`:
|
|
36
|
+
|
|
37
|
+
```tsx title="src/component/Logo.tsx"
|
|
38
|
+
import { ReactComponent as Logo } from './static/logo.svg';
|
|
39
|
+
|
|
40
|
+
export default () => <Logo />;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Modify the Default Export
|
|
44
|
+
|
|
45
|
+
You can modify the default export of SVG files through the [output.svgDefaultExport](/configure/app/output/svg-default-export) config. For example, set the default export as a React component:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
export default {
|
|
49
|
+
output: {
|
|
50
|
+
svgDefaultExport: 'component',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then import the SVG, you'll get a React component instead of a URL:
|
|
56
|
+
|
|
57
|
+
```tsx title="src/component/Logo.tsx"
|
|
58
|
+
import Logo from './static/logo.svg';
|
|
59
|
+
|
|
60
|
+
export default () => <Logo />;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Import SVG in CSS file
|
|
64
|
+
|
|
65
|
+
When import an SVG in a CSS file, the SVG is treated as a normal static asset and you will get a URL:
|
|
66
|
+
|
|
67
|
+
```css
|
|
68
|
+
.logo {
|
|
69
|
+
background-image: url('../static/logo.svg');
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Assets Processing
|
|
74
|
+
|
|
75
|
+
When SVG is imported not as a React component but as a normal static asset, it is processed exactly the same as other static assets, and it is also affected by rules such as assets inlining and URL prefixing.
|
|
76
|
+
|
|
77
|
+
Please read the [Import Static Assets](/guides/basic-features/static-assets) section to understand the processing rules for static assets.
|
|
78
|
+
|
|
79
|
+
## Disable SVGR Processing
|
|
80
|
+
|
|
81
|
+
By default, when an SVG resource is referenced in a JS file, Modern.js will call SVGR to convert the SVG into a React component. If you are sure that all SVG resources in your project are not being used as React components, you can turn off this conversion by setting [disableSvgr](/configure/app/output/disable-svgr) to true to improve build performance.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
export default {
|
|
85
|
+
output: {
|
|
86
|
+
disableSvgr: true,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Add type declaration
|
|
92
|
+
|
|
93
|
+
When you reference an SVG asset in TypeScript code, TypeScript may prompt that the module is missing a type definition:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
TS2307: Cannot find module './logo.svg' or its corresponding type declarations.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
To fix this, you need to add a type declaration file for the SVG asset, please create a `src/global.d.ts` file, and add the following type declaration:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
declare module '*.svg' {
|
|
103
|
+
export const ReactComponent: React.FunctionComponent<
|
|
104
|
+
React.SVGProps<SVGSVGElement>
|
|
105
|
+
>;
|
|
106
|
+
|
|
107
|
+
const content: string;
|
|
108
|
+
export default content;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare module '*.svg?react' {
|
|
112
|
+
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
113
|
+
export default ReactComponent;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If you set `svgDefaultExport` to `'component'`, then change the type declaration to:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
declare module '*.svg' {
|
|
121
|
+
export const ReactComponent: React.FunctionComponent<
|
|
122
|
+
React.SVGProps<SVGSVGElement>
|
|
123
|
+
>;
|
|
124
|
+
|
|
125
|
+
export default ReactComponent;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
After adding the type declaration, if the type error still exists, you can try to restart the current IDE, or adjust the directory where `global.d.ts` is located, making sure the TypeScript can correctly identify the type definition.
|
|
130
|
+
|
|
131
|
+
## Modify the SVGR configuration
|
|
132
|
+
|
|
133
|
+
When SVGR is enabled, its default configuration is as follows:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
{
|
|
137
|
+
svgo: true,
|
|
138
|
+
svgoConfig: {
|
|
139
|
+
plugins: [
|
|
140
|
+
{
|
|
141
|
+
name: 'preset-default',
|
|
142
|
+
params: {
|
|
143
|
+
overrides: {
|
|
144
|
+
removeViewBox: false,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
'prefixIds',
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If you need to modify the SVGR configuration, you can do the following:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
export default {
|
|
158
|
+
tools: {
|
|
159
|
+
bundlerChain: (chain, { CHAIN_ID }) => {
|
|
160
|
+
chain.module
|
|
161
|
+
.rule(CHAIN_ID.RULE.SVG)
|
|
162
|
+
.oneOf(CHAIN_ID.ONE_OF.SVG)
|
|
163
|
+
.use(CHAIN_ID.USE.SVGR)
|
|
164
|
+
.tap(options => {
|
|
165
|
+
// modify svgoConfig
|
|
166
|
+
options.svgoConfig.plugins[0].params.overrides.removeUselessDefs = false;
|
|
167
|
+
return options;
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 13
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Import Wasm Assets
|
|
6
|
+
|
|
7
|
+
Modern.js supports import WebAssembly assets in code.
|
|
8
|
+
|
|
9
|
+
:::tip What is WebAssembly
|
|
10
|
+
WebAssembly (Wasm) is a portable, high-performance binary format designed to execute CPU-intensive computing tasks in modern web browsers, bringing performance and reliability similar to native compiled code to the web platform.
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
## Import
|
|
14
|
+
|
|
15
|
+
You can import a WebAssembly module via named import in a JavaScript file:
|
|
16
|
+
|
|
17
|
+
```js title="index.js"
|
|
18
|
+
import { add } from './add.wasm';
|
|
19
|
+
|
|
20
|
+
console.log(add); // [native code]
|
|
21
|
+
console.log(add(1, 2)); // 3
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
WebAssembly modules can also be imported via dynamic import:
|
|
25
|
+
|
|
26
|
+
```js title="index.js"
|
|
27
|
+
import('./add.wasm').then(({ add }) => {
|
|
28
|
+
console.log('---- Async Wasm Module');
|
|
29
|
+
console.log(add); // [native code]
|
|
30
|
+
console.log(add(1, 2)); // 3
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can also get the path of a WebAssembly module using the `new URL` syntax:
|
|
35
|
+
|
|
36
|
+
```js title="index.js"
|
|
37
|
+
const wasmURL = new URL('./add.wasm', import.meta.url);
|
|
38
|
+
|
|
39
|
+
console.log(wasmURL).pathname; // "/static/wasm/[hash].module.wasm"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Output Directory
|
|
43
|
+
|
|
44
|
+
When a `.wasm` asset is imported, it will be output by Modern.js to the `dist/static/wasm` directory by default.
|
|
45
|
+
|
|
46
|
+
You can change the output directory of `.wasm` files via [output.distPath](/configure/app/output/dist-path) config.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
export default {
|
|
50
|
+
output: {
|
|
51
|
+
distPath: {
|
|
52
|
+
wasm: 'resource/wasm',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Add Type Declaration
|
|
59
|
+
|
|
60
|
+
When you import a Wasm file in TypeScript code, you usually need to add the corresponding type declaration.
|
|
61
|
+
|
|
62
|
+
For example, the `add.wasm` file exports an `add()` method, then you can create an `add.wasm.d.ts` file in the same directory and add the corresponding type declaration:
|
|
63
|
+
|
|
64
|
+
```ts title="add.wasm.d.ts"
|
|
65
|
+
export const add = (num1: number, num2: number) => number;
|
|
66
|
+
```
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 10
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Import Static Assets
|
|
6
|
+
|
|
7
|
+
Modern.js supports import static assets, including images, fonts, and medias.
|
|
8
|
+
|
|
9
|
+
:::tip What is Static Assets
|
|
10
|
+
Static assets are files that are part of a web application and do not change, even when the application is being used. Examples of static assets include images, fonts, medias, stylesheets, and JavaScript files. These assets are typically stored on a web server or CDN, and delivered to the user's web browser when the Web application is accessed. Because they do not change, static assets can be cached by the browser, which helps to improve the performance of the Web application.
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
## Assets Format
|
|
14
|
+
|
|
15
|
+
The following are the formats supported by Modern.js by default:
|
|
16
|
+
|
|
17
|
+
- **Image**: png, jpg, jpeg, gif, svg, bmp, webp, ico, apng, avif, tiff.
|
|
18
|
+
- **Fonts**: woff, woff2, eot, ttf, otf, ttc.
|
|
19
|
+
- **Media**: mp4, webm, ogg, mp3, wav, flac, aac, mov.
|
|
20
|
+
|
|
21
|
+
If you need to import assets in other formats, please refer to [Extend Asset Types](#extend-asset-types).
|
|
22
|
+
|
|
23
|
+
:::tip SVG images
|
|
24
|
+
SVG image is a special case. Modern.js support convert SVG to React components, so SVG is processed separately. For details, see [Import SVG Assets](/guides/basic-features/static-assets/svg-assets.html).
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
## Import Assets in JS file
|
|
28
|
+
|
|
29
|
+
In JS files, you can directly import static assets in relative paths:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
// Import the logo.png image in the static directory
|
|
33
|
+
import logo from './static/logo.png';
|
|
34
|
+
|
|
35
|
+
export default () => <img src={logo} />;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Import with [alias](/guides/basic-features/alias.html) are also supported:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import logo from '@/static/logo.png';
|
|
42
|
+
|
|
43
|
+
export default () => <img src={logo} />;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Import Assets in CSS file
|
|
47
|
+
|
|
48
|
+
In CSS files, you can reference static assets in relative paths:
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
.logo {
|
|
52
|
+
background-image: url('../static/logo.png');
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Import with [alias](/guides/basic-features/alias.html) are also supported:
|
|
57
|
+
|
|
58
|
+
```css
|
|
59
|
+
.logo {
|
|
60
|
+
background-image: url('@/static/logo.png');
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Import Results
|
|
65
|
+
|
|
66
|
+
The result of importing static assets depends on the file size:
|
|
67
|
+
|
|
68
|
+
- When the file size is greater than 10KB, a URL will be returned, and the file will be output to the dist directory.
|
|
69
|
+
- When the file size is less than 10KB, it will be automatically inlined to Base64 format.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import largeImage from './static/largeImage.png';
|
|
73
|
+
import smallImage from './static/smallImage.png';
|
|
74
|
+
|
|
75
|
+
console.log(largeImage); // "/static/largeImage.6c12aba3.png"
|
|
76
|
+
console.log(smallImage); // "data:image/png;base64,iVBORw0KGgo..."
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For a more detailed introduction to asset inlining, please refer to the [Static Asset Inlining](/guides/advanced-features/page-performance/inline-assets) chapter.
|
|
80
|
+
|
|
81
|
+
## Output Files
|
|
82
|
+
|
|
83
|
+
When static assets are imported, they will be output to the dist directory. You can:
|
|
84
|
+
|
|
85
|
+
- Modify the output filename through [output.filename](/configure/app/output/filename).
|
|
86
|
+
- Modify the output path through [output.distPath](/configure/app/output/dist-path).
|
|
87
|
+
|
|
88
|
+
Please read [Output Files](/guides/basic-features/output-files) for details.
|
|
89
|
+
|
|
90
|
+
## URL Prefix
|
|
91
|
+
|
|
92
|
+
The URL returned after importing a asset will automatically include the path prefix:
|
|
93
|
+
|
|
94
|
+
- In development, using [dev.assetPrefix](/configure/app/dev/asset-prefix) to set the path prefix.
|
|
95
|
+
- In production, using [output.assetPrefix](/configure/app/output/asset-prefix) to set the path prefix.
|
|
96
|
+
|
|
97
|
+
For example, you can set `output.assetPrefix` to `https://modern.com`:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import logo from './static/logo.png';
|
|
101
|
+
|
|
102
|
+
console.log(logo); // "https://modern.com/static/logo.6c12aba3.png"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Add Type Declaration
|
|
106
|
+
|
|
107
|
+
When you import static assets in TypeScript code, TypeScript may prompt that the module is missing a type definition:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
TS2307: Cannot find module './logo.png' or its corresponding type declarations.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
To fix this, you need to add a type declaration file for the static assets, please create a `src/global.d.ts` file, and add the corresponding type declaration. Taking png images as an example, you need to add the following declarations:
|
|
114
|
+
|
|
115
|
+
```ts title="src/global.d.ts"
|
|
116
|
+
declare module '*.png' {
|
|
117
|
+
const content: string;
|
|
118
|
+
export default content;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
After adding the type declaration, if the type error still exists, you can try to restart the current IDE, or adjust the directory where `global.d.ts` is located, making sure the TypeScript can correctly identify the type definition.
|
|
123
|
+
|
|
124
|
+
## Extend Asset Types
|
|
125
|
+
|
|
126
|
+
If the built-in asset types in Modern.js cannot meet your requirements, you can modify the built-in Rspack configuration and extend the asset types you need using [tools.bundlerChain](/configure/app/tools/bundler-chain).
|
|
127
|
+
|
|
128
|
+
For example, if you want to treat `*.pdf` files as assets and directly output them to the dist directory, you can add the following configuration:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
export default {
|
|
132
|
+
tools: {
|
|
133
|
+
bundlerChain(chain) {
|
|
134
|
+
chain.module
|
|
135
|
+
.rule('pdf')
|
|
136
|
+
.test(/\.pdf$/)
|
|
137
|
+
.type('asset/resource');
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
After adding the above configuration, you can import `*.pdf` files in your code, for example:
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
import myFile from './static/myFile.pdf';
|
|
147
|
+
|
|
148
|
+
console.log(myFile); // "/static/myFile.6c12aba3.pdf"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
For more information about asset modules, please refer to:
|
|
152
|
+
|
|
153
|
+
- [Rspack Documentation - Asset modules](https://rspack.rs/guide/asset-module.html#asset-modules)
|
|
154
|
+
|
|
155
|
+
## Image Format
|
|
156
|
+
|
|
157
|
+
When using image assets, you can choose a appropriate image format according to the pros and cons in the table below.
|
|
158
|
+
|
|
159
|
+
| Format | Pros | Cons | Scenarios |
|
|
160
|
+
| ------ | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
161
|
+
| PNG | Lossless compression, no loss of picture details, no distortion, support for translucency | Not suitable for pictures with complex color tables | Suitable for pictures with few colors and well-defined borders, suitable for logos, icons, transparent images and other scenes |
|
|
162
|
+
| JPG | Rich colors | Lossy compression, which will cause image distortion, does not support transparency | Suitable for pictures with a large number of colors, gradients, and overly complex pictures, suitable for portrait photos, landscapes and other scenes |
|
|
163
|
+
| WebP | Supports both lossy and lossless compression, supports transparency, and is much smaller than PNG and JPG | iOS compatibility is not good | Pixel images of almost any scene, and the hosting environment that supports WebP, should prefer WebP image format |
|
|
164
|
+
| SVG | Lossless format, no distortion, supports transparency | Not suitable for complex graphics | Suitable for vector graphics, suitable for icons |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
["playwright", "rstest", "vitest", "jest", "cypress"]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Cypress
|
|
2
|
+
|
|
3
|
+
Cypress is a framework for E2E testing and component testing.
|
|
4
|
+
|
|
5
|
+
To use Cypress in Modern.js, you need to install the dependencies first. You can run the following commands:
|
|
6
|
+
|
|
7
|
+
import { PackageManagerTabs } from '@theme';
|
|
8
|
+
|
|
9
|
+
<PackageManagerTabs command={{ npm: "npm install -D cypress", yarn: "yarn add -D cypress", pnpm: "pnpm install -D cypress" }} />
|
|
10
|
+
|
|
11
|
+
Next, create a `cypress.config.ts` file and add the following content:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { defineConfig } from 'cypress'
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
e2e: {
|
|
18
|
+
setupNodeEvents(on, config) {},
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Writing Test Cases
|
|
24
|
+
|
|
25
|
+
Now, use Cypress to write an E2E test case by first creating two Modern.js pages.
|
|
26
|
+
|
|
27
|
+
```tsx title="routes/page.tsx"
|
|
28
|
+
import { Link } from '@modern-js/runtime/router';
|
|
29
|
+
|
|
30
|
+
const Index = () => (
|
|
31
|
+
<div>
|
|
32
|
+
<h1>Home</h1>
|
|
33
|
+
<Link to="/about">About</Link>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default Index;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```tsx title="routes/about/page.tsx"
|
|
41
|
+
import { Link } from '@modern-js/runtime/router';
|
|
42
|
+
|
|
43
|
+
const Index = () => (
|
|
44
|
+
<div>
|
|
45
|
+
<h1>About</h1>
|
|
46
|
+
<Link to="/">Home</Link>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default Index;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Next, create the test case file:
|
|
54
|
+
|
|
55
|
+
```ts title="cypress/e2e/app.cy.ts"
|
|
56
|
+
describe('Navigation', () => {
|
|
57
|
+
it('should navigate to the about page', () => {
|
|
58
|
+
// Start from the index page
|
|
59
|
+
cy.visit('http://localhost:8080/')
|
|
60
|
+
|
|
61
|
+
// Find a link with an href attribute containing "about" and click it
|
|
62
|
+
cy.get('a[href*="about"]').click()
|
|
63
|
+
|
|
64
|
+
// The new url should include "/about"
|
|
65
|
+
cy.url().should('include', '/about')
|
|
66
|
+
|
|
67
|
+
// The new page should contain an h1 with "About"
|
|
68
|
+
cy.get('h1').contains('About')
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The test file may lack type definitions for the API. You can refer to the [Cypress - Typescript](https://docs.cypress.io/guides/tooling/typescript-support#Configure-tsconfigjson) documentation to resolve this.
|
|
74
|
+
|
|
75
|
+
You can add the command to your `package.json`:
|
|
76
|
+
|
|
77
|
+
```json title="package.json"
|
|
78
|
+
{
|
|
79
|
+
"scripts": {
|
|
80
|
+
"test": "cypress open"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Run Test Cases
|
|
86
|
+
|
|
87
|
+
Execute the above `test` command to run the test cases:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
DevTools listening on ws://127.0.0.1:55203/devtools/browser/xxxxx
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Cypress will open a headless browser. Following the prompts, you can find the corresponding test files and automatically run the E2E tests:
|
|
94
|
+
|
|
95
|
+

|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Jest
|
|
2
|
+
|
|
3
|
+
Jest is a JavaScript testing framework that is primarily used with React Testing Library for unit testing and Snapshot testing.
|
|
4
|
+
|
|
5
|
+
To use Jest in Modern.js, you need to install the dependencies first. You can run the following commands:
|
|
6
|
+
|
|
7
|
+
import { PackageManagerTabs } from '@theme';
|
|
8
|
+
|
|
9
|
+
<PackageManagerTabs command={{
|
|
10
|
+
npm: "npm install -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom",
|
|
11
|
+
yarn: "yarn add -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom",
|
|
12
|
+
pnpm: "pnpm install -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom"
|
|
13
|
+
}} />
|
|
14
|
+
|
|
15
|
+
Next, you can run the following commands to automatically initialize Jest in your project and generate a basic `jest.config.ts` configuration:
|
|
16
|
+
|
|
17
|
+
<PackageManagerTabs command={{
|
|
18
|
+
npm: "npm init jest@latest",
|
|
19
|
+
yarn: "yarn create jest@latest",
|
|
20
|
+
pnpm: "pnpm create jest@latest"
|
|
21
|
+
}} />
|
|
22
|
+
|
|
23
|
+
## Configuration File
|
|
24
|
+
|
|
25
|
+
:::note
|
|
26
|
+
This section will use `.ts` files for Jest testing.
|
|
27
|
+
:::
|
|
28
|
+
|
|
29
|
+
Compared to other testing frameworks, Jest requires more configuration at the build level, such as handling JSX and ESM syntax. Therefore, you need to install some additional dependencies:
|
|
30
|
+
|
|
31
|
+
<PackageManagerTabs command={{
|
|
32
|
+
npm: "npm install -D babel-jest @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript",
|
|
33
|
+
yarn: "yarn add -D babel-jest @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript",
|
|
34
|
+
pnpm: "pnpm install -D babel-jest @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript"
|
|
35
|
+
}} />
|
|
36
|
+
|
|
37
|
+
### Configure Jest
|
|
38
|
+
|
|
39
|
+
You need to further configure the `jest.config.ts` file to allow Jest to correctly compile and run test cases. Here is a basic configuration:
|
|
40
|
+
|
|
41
|
+
```ts title="jest.config.ts"
|
|
42
|
+
import type { Config } from 'jest';
|
|
43
|
+
|
|
44
|
+
const config: Config = {
|
|
45
|
+
coverageProvider: 'babel',
|
|
46
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
47
|
+
testEnvironment: 'jsdom',
|
|
48
|
+
transform: {
|
|
49
|
+
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
|
|
50
|
+
},
|
|
51
|
+
transformIgnorePatterns: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default config;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
In the configuration, the `transformIgnorePatterns` is set to an empty array, meaning that all files will be compiled. If you want to speed up the test run, you can configure it as needed.
|
|
58
|
+
|
|
59
|
+
The `setupFilesAfterEnv` will be executed at startup. In `jest.setup.ts`, you can import `@testing-library/jest-dom`, which includes a set of convenient custom matchers, such as `.toBeInTheDocument()`, to make writing tests easier:
|
|
60
|
+
|
|
61
|
+
```ts title="jest.setup.ts"
|
|
62
|
+
import '@testing-library/jest-dom';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Configure Babel
|
|
66
|
+
|
|
67
|
+
You need to configure Babel to allow Jest to automatically compile JSX and other syntax. Here is a basic configuration:
|
|
68
|
+
|
|
69
|
+
```js title="babel.config.js"
|
|
70
|
+
module.exports = {
|
|
71
|
+
presets: [
|
|
72
|
+
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
73
|
+
['@babel/preset-react', { runtime: 'automatic' }],
|
|
74
|
+
'@babel/preset-typescript',
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Writing Test Cases
|
|
80
|
+
|
|
81
|
+
Now, you can start writing tests. First, add a `test` command in `package.json`:
|
|
82
|
+
|
|
83
|
+
```json title="package.json"
|
|
84
|
+
{
|
|
85
|
+
"scripts": {
|
|
86
|
+
"test": "jest"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Create a simple page for testing:
|
|
92
|
+
|
|
93
|
+
```tsx title="routes/page.tsx"
|
|
94
|
+
import { Link } from '@modern-js/runtime/router';
|
|
95
|
+
|
|
96
|
+
const Index = () => (
|
|
97
|
+
<div>
|
|
98
|
+
<h1>Home</h1>
|
|
99
|
+
<Link to="/about">About</Link>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export default Index;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Add a test case to check if the page has the expected text:
|
|
107
|
+
|
|
108
|
+
```tsx title="__tests__/page.test.tsx"
|
|
109
|
+
import '@testing-library/jest-dom';
|
|
110
|
+
import { render, screen } from '@testing-library/react';
|
|
111
|
+
import { BrowserRouter as Router } from '@modern-js/runtime/router';
|
|
112
|
+
import Page from '../routes/page';
|
|
113
|
+
|
|
114
|
+
describe('Page', () => {
|
|
115
|
+
it('renders a heading', () => {
|
|
116
|
+
render(
|
|
117
|
+
<Router>
|
|
118
|
+
<Page />
|
|
119
|
+
</Router>,
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const heading = screen.getByRole('heading', { level: 1 });
|
|
123
|
+
|
|
124
|
+
expect(heading).toBeInTheDocument();
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
In the above test case, we imported the `<Router>` component from `@modern-js/runtime/router` because React Router requires the corresponding context when rendering some route-related components.
|
|
130
|
+
|
|
131
|
+
:::note
|
|
132
|
+
When running directly in the Modern.js application, the `<Router>` component will be automatically injected.
|
|
133
|
+
:::
|
|
134
|
+
|
|
135
|
+
## Run Test Cases
|
|
136
|
+
|
|
137
|
+
Execute the above `test` command to run the test cases:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
PASS src/__tests__/page.test.tsx
|
|
141
|
+
Page
|
|
142
|
+
✓ renders a heading (31 ms)
|
|
143
|
+
|
|
144
|
+
Test Suites: 1 passed, 1 total
|
|
145
|
+
Tests: 1 passed, 1 total
|
|
146
|
+
Snapshots: 0 total
|
|
147
|
+
Time: 0.959 s, estimated 1 s
|
|
148
|
+
```
|