@modern-js/app-tools 3.7.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modern-bundle-docs.js +7 -0
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +5 -1
- package/dist/cjs/bundleDocs.js +114 -0
- package/dist/cjs/commands/build.js +2 -1
- package/dist/cjs/commands/deploy.js +4 -2
- package/dist/cjs/commands/index.js +0 -4
- package/dist/cjs/config/default.js +2 -0
- package/dist/cjs/index.js +52 -14
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +3 -2
- package/dist/cjs/plugins/initialize/index.js +4 -3
- package/dist/cjs/plugins/serverBuild.js +3 -2
- package/dist/esm/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm/bundleDocs.mjs +62 -0
- package/dist/esm/commands/build.mjs +2 -1
- package/dist/esm/commands/deploy.mjs +4 -2
- package/dist/esm/commands/index.mjs +0 -4
- package/dist/esm/config/default.mjs +2 -0
- package/dist/esm/index.mjs +15 -1
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +3 -2
- package/dist/esm/plugins/initialize/index.mjs +4 -3
- package/dist/esm/plugins/serverBuild.mjs +3 -2
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm-node/bundleDocs.mjs +63 -0
- package/dist/esm-node/commands/build.mjs +2 -1
- package/dist/esm-node/commands/deploy.mjs +4 -2
- package/dist/esm-node/commands/index.mjs +0 -4
- package/dist/esm-node/config/default.mjs +2 -0
- package/dist/esm-node/index.mjs +15 -1
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +3 -2
- package/dist/esm-node/plugins/initialize/index.mjs +4 -3
- package/dist/esm-node/plugins/serverBuild.mjs +3 -2
- package/dist/types/bundleDocs.d.ts +20 -0
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/types/config/dev.d.ts +6 -0
- package/docs/apis/app/commands.md +241 -0
- package/docs/apis/app/hooks/api/lambda.md +9 -0
- package/docs/apis/app/hooks/config/favicon.md +24 -0
- package/docs/apis/app/hooks/config/html.md +5 -0
- package/docs/apis/app/hooks/config/icon.md +24 -0
- package/docs/apis/app/hooks/config/mock.md +6 -0
- package/docs/apis/app/hooks/config/public.md +26 -0
- package/docs/apis/app/hooks/config/upload.md +50 -0
- package/docs/apis/app/hooks/modern-config.md +5 -0
- package/docs/apis/app/hooks/server/server.md +5 -0
- package/docs/apis/app/hooks/shared.md +3 -0
- package/docs/apis/app/hooks/src/app.md +30 -0
- package/docs/apis/app/hooks/src/entry.md +34 -0
- package/docs/apis/app/hooks/src/entry.server.md +51 -0
- package/docs/apis/app/hooks/src/modern.runtime.md +5 -0
- package/docs/apis/app/hooks/src/routes.md +86 -0
- package/docs/apis/app/hooks/src/server.md +3 -0
- package/docs/apis/app/runtime/bff/use-hono-context.md +27 -0
- package/docs/apis/app/runtime/core/create-root.md +19 -0
- package/docs/apis/app/runtime/core/render.md +39 -0
- package/docs/apis/app/runtime/core/runtime-context.md +156 -0
- package/docs/apis/app/runtime/router/router.md +280 -0
- package/docs/apis/app/runtime/ssr/no-ssr.md +35 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.md +67 -0
- package/docs/apis/app/runtime/ssr/renderString.md +60 -0
- package/docs/apis/app/runtime/ssr/requestHandler.md +44 -0
- package/docs/apis/app/runtime/utility/css-in-js.md +40 -0
- package/docs/apis/app/runtime/utility/head.md +35 -0
- package/docs/apis/app/runtime/utility/loadable.md +82 -0
- package/docs/community/blog/2022-0708-updates.md +91 -0
- package/docs/community/blog/2022-0910-updates.md +76 -0
- package/docs/community/blog/overview.md +63 -0
- package/docs/community/blog/v2-release-note.md +238 -0
- package/docs/community/blog/v3-release-note.md +622 -0
- package/docs/community/contributing-guide.md +253 -0
- package/docs/community/releases.md +27 -0
- package/docs/community/showcase.md +34 -0
- package/docs/community/team.md +14 -0
- package/docs/configure/app/bff/cross-project.md +20 -0
- package/docs/configure/app/bff/prefix.md +29 -0
- package/docs/configure/app/builder-plugins.md +66 -0
- package/docs/configure/app/dev/asset-prefix.md +13 -0
- package/docs/configure/app/dev/before-start-url.md +17 -0
- package/docs/configure/app/dev/client.md +41 -0
- package/docs/configure/app/dev/hmr.md +10 -0
- package/docs/configure/app/dev/host.md +18 -0
- package/docs/configure/app/dev/https.md +77 -0
- package/docs/configure/app/dev/lazy-compilation.md +39 -0
- package/docs/configure/app/dev/live-reload.md +10 -0
- package/docs/configure/app/dev/mock-dir.md +31 -0
- package/docs/configure/app/dev/progress-bar.md +19 -0
- package/docs/configure/app/dev/server.md +124 -0
- package/docs/configure/app/dev/setup-middlewares.md +32 -0
- package/docs/configure/app/dev/start-url.md +48 -0
- package/docs/configure/app/dev/watch-files.md +27 -0
- package/docs/configure/app/dev/write-to-disk.md +10 -0
- package/docs/configure/app/experiments/source-build.md +31 -0
- package/docs/configure/app/html/app-icon.md +28 -0
- package/docs/configure/app/html/crossorigin.md +10 -0
- package/docs/configure/app/html/favicon.md +16 -0
- package/docs/configure/app/html/inject.md +10 -0
- package/docs/configure/app/html/meta.md +24 -0
- package/docs/configure/app/html/mount-id.md +10 -0
- package/docs/configure/app/html/output-structure.md +10 -0
- package/docs/configure/app/html/script-loading.md +10 -0
- package/docs/configure/app/html/tags.md +15 -0
- package/docs/configure/app/html/template-parameters.md +33 -0
- package/docs/configure/app/html/template.md +10 -0
- package/docs/configure/app/html/title.md +18 -0
- package/docs/configure/app/output/asset-prefix.md +11 -0
- package/docs/configure/app/output/assets-retry.md +77 -0
- package/docs/configure/app/output/charset.md +10 -0
- package/docs/configure/app/output/clean-dist-path.md +16 -0
- package/docs/configure/app/output/convert-to-rem.md +79 -0
- package/docs/configure/app/output/copy.md +10 -0
- package/docs/configure/app/output/css-modules.md +48 -0
- package/docs/configure/app/output/data-uri-limit.md +26 -0
- package/docs/configure/app/output/disable-css-module-extension.md +55 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.md +41 -0
- package/docs/configure/app/output/disable-svgr.md +16 -0
- package/docs/configure/app/output/disable-ts-checker.md +49 -0
- package/docs/configure/app/output/dist-path.md +43 -0
- package/docs/configure/app/output/enable-asset-manifest.md +36 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.md +28 -0
- package/docs/configure/app/output/enable-inline-route-manifests.md +16 -0
- package/docs/configure/app/output/externals.md +20 -0
- package/docs/configure/app/output/filename-hash.md +10 -0
- package/docs/configure/app/output/filename.md +55 -0
- package/docs/configure/app/output/inject-styles.md +10 -0
- package/docs/configure/app/output/inline-scripts.md +29 -0
- package/docs/configure/app/output/inline-styles.md +29 -0
- package/docs/configure/app/output/legal-comments.md +18 -0
- package/docs/configure/app/output/minify.md +22 -0
- package/docs/configure/app/output/override-browserslist.md +22 -0
- package/docs/configure/app/output/polyfill.md +12 -0
- package/docs/configure/app/output/source-map.md +30 -0
- package/docs/configure/app/output/split-route-chunks.md +16 -0
- package/docs/configure/app/output/ssg.md +81 -0
- package/docs/configure/app/output/ssgByEntries.md +90 -0
- package/docs/configure/app/output/svg-default-export.md +30 -0
- package/docs/configure/app/output/temp-dir.md +20 -0
- package/docs/configure/app/performance/build-cache.md +39 -0
- package/docs/configure/app/performance/chunk-split.md +40 -0
- package/docs/configure/app/performance/dns-prefetch.md +15 -0
- package/docs/configure/app/performance/preconnect.md +16 -0
- package/docs/configure/app/performance/prefetch.md +21 -0
- package/docs/configure/app/performance/preload.md +23 -0
- package/docs/configure/app/performance/print-file-size.md +40 -0
- package/docs/configure/app/performance/profile.md +10 -0
- package/docs/configure/app/performance/remove-console.md +10 -0
- package/docs/configure/app/performance/remove-moment-locale.md +10 -0
- package/docs/configure/app/plugins.md +59 -0
- package/docs/configure/app/resolve/alias-strategy.md +10 -0
- package/docs/configure/app/resolve/alias.md +9 -0
- package/docs/configure/app/resolve/condition-names.md +13 -0
- package/docs/configure/app/resolve/dedupe.md +9 -0
- package/docs/configure/app/resolve/extensions.md +13 -0
- package/docs/configure/app/runtime/0-intro.md +58 -0
- package/docs/configure/app/runtime/plugins.md +58 -0
- package/docs/configure/app/runtime/router.md +35 -0
- package/docs/configure/app/security/check-syntax.md +69 -0
- package/docs/configure/app/security/nonce.md +15 -0
- package/docs/configure/app/security/sri.md +20 -0
- package/docs/configure/app/server/base-url.md +26 -0
- package/docs/configure/app/server/port.md +18 -0
- package/docs/configure/app/server/public-routes.md +22 -0
- package/docs/configure/app/server/routes.md +86 -0
- package/docs/configure/app/server/rsc.md +26 -0
- package/docs/configure/app/server/ssr-by-entries.md +25 -0
- package/docs/configure/app/server/ssr.md +78 -0
- package/docs/configure/app/server/tsconfig-path.md +59 -0
- package/docs/configure/app/source/alias-strategy.md +14 -0
- package/docs/configure/app/source/alias.md +23 -0
- package/docs/configure/app/source/config-dir.md +20 -0
- package/docs/configure/app/source/decorators.md +25 -0
- package/docs/configure/app/source/define.md +16 -0
- package/docs/configure/app/source/disable-default-entries.md +28 -0
- package/docs/configure/app/source/enable-async-entry.md +54 -0
- package/docs/configure/app/source/enable-async-pre-entry.md +26 -0
- package/docs/configure/app/source/entries-dir.md +35 -0
- package/docs/configure/app/source/entries.md +179 -0
- package/docs/configure/app/source/exclude.md +10 -0
- package/docs/configure/app/source/global-vars.md +106 -0
- package/docs/configure/app/source/include.md +36 -0
- package/docs/configure/app/source/main-entry-name.md +24 -0
- package/docs/configure/app/source/pre-entry.md +10 -0
- package/docs/configure/app/source/react-compiler.md +68 -0
- package/docs/configure/app/source/transform-import.md +27 -0
- package/docs/configure/app/split-chunks.md +17 -0
- package/docs/configure/app/tools/autoprefixer.md +44 -0
- package/docs/configure/app/tools/bundler-chain.md +26 -0
- package/docs/configure/app/tools/css-extract.md +33 -0
- package/docs/configure/app/tools/css-loader.md +17 -0
- package/docs/configure/app/tools/dev-server.md +113 -0
- package/docs/configure/app/tools/html-plugin.md +41 -0
- package/docs/configure/app/tools/less.md +81 -0
- package/docs/configure/app/tools/lightningcss-loader.md +35 -0
- package/docs/configure/app/tools/minify-css.md +53 -0
- package/docs/configure/app/tools/postcss.md +34 -0
- package/docs/configure/app/tools/rspack.md +10 -0
- package/docs/configure/app/tools/sass.md +78 -0
- package/docs/configure/app/tools/style-loader.md +10 -0
- package/docs/configure/app/tools/swc.md +65 -0
- package/docs/configure/app/tools/ts-checker.md +109 -0
- package/docs/configure/app/usage.md +276 -0
- package/docs/guides/advanced-features/bff/cross-project.md +109 -0
- package/docs/guides/advanced-features/bff/extend-server.md +120 -0
- package/docs/guides/advanced-features/bff/frameworks.md +124 -0
- package/docs/guides/advanced-features/bff/function.md +314 -0
- package/docs/guides/advanced-features/bff/operators.md +554 -0
- package/docs/guides/advanced-features/bff/sdk.md +116 -0
- package/docs/guides/advanced-features/bff/upload.md +101 -0
- package/docs/guides/advanced-features/bff.md +18 -0
- package/docs/guides/advanced-features/build-performance.md +130 -0
- package/docs/guides/advanced-features/compatibility.md +120 -0
- package/docs/guides/advanced-features/international/advanced.md +128 -0
- package/docs/guides/advanced-features/international/api.md +231 -0
- package/docs/guides/advanced-features/international/best-practices.md +286 -0
- package/docs/guides/advanced-features/international/configuration.md +227 -0
- package/docs/guides/advanced-features/international/locale-detection.md +126 -0
- package/docs/guides/advanced-features/international/quick-start.md +128 -0
- package/docs/guides/advanced-features/international/resource-loading.md +154 -0
- package/docs/guides/advanced-features/international/routing.md +130 -0
- package/docs/guides/advanced-features/international.md +27 -0
- package/docs/guides/advanced-features/low-level.md +46 -0
- package/docs/guides/advanced-features/page-performance/code-split.md +77 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.md +159 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.md +97 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.md +69 -0
- package/docs/guides/advanced-features/server-monitor/logger.md +41 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
- package/docs/guides/advanced-features/server-monitor/monitors.md +242 -0
- package/docs/guides/advanced-features/source-build.md +164 -0
- package/docs/guides/advanced-features/web-server.md +288 -0
- package/docs/guides/basic-features/alias.md +102 -0
- package/docs/guides/basic-features/css/css-in-js.md +72 -0
- package/docs/guides/basic-features/css/css-modules.md +212 -0
- package/docs/guides/basic-features/css/css.md +27 -0
- package/docs/guides/basic-features/css/tailwindcss.md +27 -0
- package/docs/guides/basic-features/data/data-cache.md +510 -0
- package/docs/guides/basic-features/data/data-fetch.md +415 -0
- package/docs/guides/basic-features/data/data-write.md +227 -0
- package/docs/guides/basic-features/debug/mock.md +109 -0
- package/docs/guides/basic-features/debug/proxy.md +21 -0
- package/docs/guides/basic-features/debug/rsdoctor.md +62 -0
- package/docs/guides/basic-features/debug/using-storybook.md +112 -0
- package/docs/guides/basic-features/deploy.md +458 -0
- package/docs/guides/basic-features/env-vars.md +177 -0
- package/docs/guides/basic-features/html.md +255 -0
- package/docs/guides/basic-features/output-files.md +141 -0
- package/docs/guides/basic-features/render/before-render.md +108 -0
- package/docs/guides/basic-features/render/overview.md +47 -0
- package/docs/guides/basic-features/render/rsc.md +525 -0
- package/docs/guides/basic-features/render/ssg.md +228 -0
- package/docs/guides/basic-features/render/ssr-cache.md +201 -0
- package/docs/guides/basic-features/render/ssr.md +321 -0
- package/docs/guides/basic-features/render/streaming-ssr.md +264 -0
- package/docs/guides/basic-features/routes/config-routes.md +426 -0
- package/docs/guides/basic-features/routes/routes.md +498 -0
- package/docs/guides/basic-features/static-assets/json-files.md +120 -0
- package/docs/guides/basic-features/static-assets/svg-assets.md +168 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.md +62 -0
- package/docs/guides/basic-features/static-assets.md +160 -0
- package/docs/guides/basic-features/testing/playwright.md +120 -0
- package/docs/guides/basic-features/testing/rstest.md +251 -0
- package/docs/guides/concept/builder.md +37 -0
- package/docs/guides/concept/entries.md +319 -0
- package/docs/guides/concept/server.md +35 -0
- package/docs/guides/get-started/ai-coding-agents.md +58 -0
- package/docs/guides/get-started/glossary.md +63 -0
- package/docs/guides/get-started/introduction.md +36 -0
- package/docs/guides/get-started/quick-start.md +236 -0
- package/docs/guides/get-started/tech-stack.md +82 -0
- package/docs/guides/get-started/upgrade.md +123 -0
- package/docs/guides/topic-detail/module-federation/application.md +116 -0
- package/docs/guides/topic-detail/module-federation/deploy.md +104 -0
- package/docs/guides/topic-detail/module-federation/i18n.md +670 -0
- package/docs/guides/topic-detail/module-federation/introduce.md +35 -0
- package/docs/guides/topic-detail/module-federation/ssr.md +118 -0
- package/docs/guides/topic-detail/module-federation/usage.md +219 -0
- package/docs/guides/troubleshooting/builder.md +110 -0
- package/docs/guides/troubleshooting/cli.md +35 -0
- package/docs/guides/troubleshooting/dependencies.md +119 -0
- package/docs/guides/troubleshooting/hmr.md +144 -0
- package/docs/guides/upgrade/config.md +963 -0
- package/docs/guides/upgrade/entry.md +463 -0
- package/docs/guides/upgrade/other.md +183 -0
- package/docs/guides/upgrade/overview.md +33 -0
- package/docs/guides/upgrade/tailwindcss.md +91 -0
- package/docs/guides/upgrade/web-server.md +109 -0
- package/docs/index.md +33 -0
- package/docs/llms.txt +285 -0
- package/docs/plugin/cli-plugins/api.md +573 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +152 -0
- package/docs/plugin/official/cli-plugins/plugin-bff.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +5 -0
- package/docs/plugin/official/cli-plugins.md +4 -0
- package/docs/plugin/plugin-system.md +238 -0
- package/docs/plugin/runtime-plugins/api.md +194 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +209 -0
- package/docs/plugin/server-plugins/life-cycle.md +13 -0
- package/docs/tutorials/examples/csr-auth.md +9 -0
- package/docs/tutorials/foundations/introduction.md +16 -0
- package/package.json +46 -13
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Contributing Guide
|
|
2
|
+
|
|
3
|
+
Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines.
|
|
4
|
+
|
|
5
|
+
## Setup the Dev Environment
|
|
6
|
+
|
|
7
|
+
### Fork the Repo
|
|
8
|
+
|
|
9
|
+
[Fork](https://help.github.com/articles/fork-a-repo/) this repository to your
|
|
10
|
+
own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local.
|
|
11
|
+
|
|
12
|
+
### Install Node.js
|
|
13
|
+
|
|
14
|
+
We recommend using Node.js 22. You can check your currently used Node.js version with the following command:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node -v
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you do not have Node.js installed in your current environment, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install it.
|
|
21
|
+
|
|
22
|
+
Here is an example of how to install the Node.js 22 LTS version via nvm:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install the LTS version of Node.js 22
|
|
26
|
+
nvm install 22 --lts
|
|
27
|
+
|
|
28
|
+
# Make the newly installed Node.js 22 as the default version
|
|
29
|
+
nvm alias default 22
|
|
30
|
+
|
|
31
|
+
# Switch to the newly installed Node.js 22
|
|
32
|
+
nvm use 22
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Install pnpm
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
# Enable pnpm with corepack, only available on Node.js >= `v14.19.0`
|
|
39
|
+
corepack enable
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Install Dependencies
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pnpm install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
What this will do:
|
|
49
|
+
|
|
50
|
+
- Install all dependencies
|
|
51
|
+
- Create symlinks between packages in the monorepo
|
|
52
|
+
- Run the `prepare` script to build all packages (this will take some time, but is necessary to make ensure all packages are built)
|
|
53
|
+
|
|
54
|
+
> A full rebuild of all packages is generally not required after this. If a new feature you are developing requires an updated version of another package, it is usually sufficient to build the changed dependencies.
|
|
55
|
+
|
|
56
|
+
### Set Git Email
|
|
57
|
+
|
|
58
|
+
Please make sure you have your email set up in `<https://github.com/settings/emails>`. This will be needed later when you want to submit a pull request.
|
|
59
|
+
|
|
60
|
+
Check that your git client is already configured the email:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
git config --list | grep email
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Set the email to global config:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
git config --global user.email "SOME_EMAIL@example.com"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Set the email for local repo:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
git config user.email "SOME_EMAIL@example.com"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Making Changes and Building
|
|
79
|
+
|
|
80
|
+
Once you have set up the local development environment in your forked repo, we can start development.
|
|
81
|
+
|
|
82
|
+
### Checkout A New Branch
|
|
83
|
+
|
|
84
|
+
It is recommended to develop on a new branch, as it will make things easier later when you submit a pull request:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
git checkout -b MY_BRANCH_NAME
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Build the Package
|
|
91
|
+
|
|
92
|
+
To build the package you want to change, first open the package directory, then run the `build` command:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
# Replace some-path with the path of the package you want to work on
|
|
96
|
+
cd ./packages/some-path
|
|
97
|
+
pnpm run build
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Alternatively, you can build the package from the root directory of the repository using the `--filter` option:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
pnpm run --filter @modern-js/some-package build
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Build all packages:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
pnpm run prepare
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If you need to clean all `node_modules/*` in the project, run the `reset` command:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
pnpm run reset
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Testing
|
|
119
|
+
|
|
120
|
+
### Add New Tests
|
|
121
|
+
|
|
122
|
+
If you've fixed a bug or added code that should be tested, then add some tests.
|
|
123
|
+
|
|
124
|
+
Modern.js uses [Rstest](https://rstest.rs/) for unit tests across the repository. You can add test cases in the `<PACKAGE_DIR>/tests` folder, using Rstest syntax.
|
|
125
|
+
|
|
126
|
+
### Run Unit Tests
|
|
127
|
+
|
|
128
|
+
Before submitting a pull request, it's important to make sure that the changes haven't introduced any regressions or bugs. You can run the unit tests for the project by executing the following command:
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
pnpm run test
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Alternatively, you can run the unit tests of single package using the `--filter` option:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
pnpm run --filter @modern-js/some-package test
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Run E2E Tests
|
|
141
|
+
|
|
142
|
+
In addition to the unit tests, the Modern.js also includes end-to-end (E2E) tests, which checks the functionality of the application as a whole.
|
|
143
|
+
|
|
144
|
+
You can run the `test:e2e` command to run the E2E tests:
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
pnpm run test:e2e
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
If you need to run a specified test, you can add keywords to filter:
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
# Only run test cases with the copy-assets keyword
|
|
154
|
+
npx rstest copy-assets
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Linting
|
|
158
|
+
|
|
159
|
+
To help maintain consistency and readability of the codebase, we use a ESLint to lint the codes.
|
|
160
|
+
|
|
161
|
+
You can run the Linter by executing the following command:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
pnpm run lint
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Benchmarking
|
|
168
|
+
|
|
169
|
+
You can input `!bench-framework` or `!bench-module` in the comment area of the PR to do benchmarking on `@modern-js/app-tools` and `@modern-js/module-tools` respectively (you need to have Collaborator and above permissions).
|
|
170
|
+
|
|
171
|
+
You can focus on metrics related to build time and bundle size based on the comparison table output by comments to assist you in making relevant performance judgments and decisions.
|
|
172
|
+
|
|
173
|
+
Dependencies installation-related metrics base on publishing process, so the data is relatively lagging and is for reference only.
|
|
174
|
+
|
|
175
|
+
## Documentation
|
|
176
|
+
|
|
177
|
+
Currently Modern.js provides documentation in English and Chinese. If you can use Chinese, please update both documents at the same time. Otherwise, just update the English documentation.
|
|
178
|
+
|
|
179
|
+
You can find all the documentation in the `packages/document` folder:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
root
|
|
183
|
+
└─ packages
|
|
184
|
+
└─ document # Documentation for Modern.js Framework
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This website is built with Rspress, the document content can be written using markdown or mdx syntax. You can refer to the [Rspress Website](https://rspress.rs/) for detailed usage.
|
|
188
|
+
|
|
189
|
+
The source code of Rspress can be found in [this repo](https://github.com/web-infra-dev/rspress).
|
|
190
|
+
|
|
191
|
+
## Submitting Changes
|
|
192
|
+
|
|
193
|
+
### Add a Changeset
|
|
194
|
+
|
|
195
|
+
Modern.js is using [Changesets](https://github.com/changesets/changesets) to manage the versioning and changelogs.
|
|
196
|
+
|
|
197
|
+
If you've changed some packages, you need add a new changeset for the changes. Please run `change` command to select the changed packages and add the changeset info.
|
|
198
|
+
|
|
199
|
+
```sh
|
|
200
|
+
pnpm run change
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Committing your Changes
|
|
204
|
+
|
|
205
|
+
Commit your changes to your forked repo, and [create a pull request](https://help.github.com/articles/creating-a-pull-request/).
|
|
206
|
+
|
|
207
|
+
### Format of PR titles
|
|
208
|
+
|
|
209
|
+
The format of PR titles follow Conventional Commits.
|
|
210
|
+
|
|
211
|
+
An example:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
feat(plugin-swc): Add `xxx` config
|
|
215
|
+
^ ^ ^
|
|
216
|
+
| | |__ Subject
|
|
217
|
+
| |_______ Scope
|
|
218
|
+
|____________ Type
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Publishing
|
|
222
|
+
|
|
223
|
+
We use **Modern.js Monorepo Solution** to manage version and changelog.
|
|
224
|
+
|
|
225
|
+
Repository maintainers can publish a new version of all packages to npm.
|
|
226
|
+
|
|
227
|
+
Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
|
|
228
|
+
|
|
229
|
+
1. Pull latest code from the `main` branch.
|
|
230
|
+
2. Install:
|
|
231
|
+
|
|
232
|
+
```sh
|
|
233
|
+
pnpm i
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
3. Build packages:
|
|
237
|
+
|
|
238
|
+
```sh
|
|
239
|
+
pnpm run prepare
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
4. Bump version:
|
|
243
|
+
|
|
244
|
+
```sh
|
|
245
|
+
pnpm run bump
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
5. Commit the version change.
|
|
249
|
+
|
|
250
|
+
```sh
|
|
251
|
+
git add .
|
|
252
|
+
git commit -m "Release va.b.c"
|
|
253
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Releases
|
|
2
|
+
|
|
3
|
+
## Changelog
|
|
4
|
+
|
|
5
|
+
Please visit [GitHub - Releases](https://github.com/web-infra-dev/modern.js/releases) to see what has changed with each release of Modern.js.
|
|
6
|
+
|
|
7
|
+
## Version Specification
|
|
8
|
+
|
|
9
|
+
Modern.js follows the [Semantic Versioning](https://semver.org) specification.
|
|
10
|
+
|
|
11
|
+
- Major version: Contains incompatible API changes.
|
|
12
|
+
- Minor version: Contains backward compatible functional changes.
|
|
13
|
+
- Patch version: Contains backwards compatible bug fixes
|
|
14
|
+
|
|
15
|
+
## Release Cycle
|
|
16
|
+
|
|
17
|
+
- Modern.js generally releases an official release every Thursday.
|
|
18
|
+
- If critical bugs appear, we will release a revised version on the same day.
|
|
19
|
+
- We expect to keep Modern.js v2 stable and compatible, there are currently no plans to release the next major version.
|
|
20
|
+
|
|
21
|
+
## Version Upgrade
|
|
22
|
+
|
|
23
|
+
When you need to upgrade the Modern.js version in your project, you can use the `modern upgrade` command, refer to [Upgrade](/guides/get-started/upgrade.md).
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx modern upgrade
|
|
27
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Showcase
|
|
2
|
+
|
|
3
|
+
Welcome to the Modern.js showcase page! Here, we present a collection of websites that have been built using Modern.js.
|
|
4
|
+
|
|
5
|
+
If you have built a website using Modern.js, we would love for you to share it with the community. Simply reply to the GitHub discussion thread with a link to your website. We will collect content on a regular basis and display it on the current page.
|
|
6
|
+
|
|
7
|
+
## The Cases
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[Tiktok SellerFramework
|
|
11
|
+
|
|
12
|
+
seller-us-accounts.tiktok.com](https://seller-us-accounts.tiktok.com/)[Tiktok StreamerFramework
|
|
13
|
+
|
|
14
|
+
shop.tiktok.com](https://shop.tiktok.com/streamer/welcome)[Tiktok Shop PartnerFramework
|
|
15
|
+
|
|
16
|
+
partner-us.tiktok.com](https://partner-us.tiktok.com/)[DoubaoFramework
|
|
17
|
+
|
|
18
|
+
www.doubao.com](https://www.doubao.com/)[VolctransFramework
|
|
19
|
+
|
|
20
|
+
translate.volcengine.com](https://translate.volcengine.com/)[WritingoFramework
|
|
21
|
+
|
|
22
|
+
writingo.net](https://writingo.net/)[RspackDoc
|
|
23
|
+
|
|
24
|
+
rspack.rs](https://rspack.rs/)[Modern.jsDoc
|
|
25
|
+
|
|
26
|
+
modernjs.dev](https://modernjs.dev/en/)[Shidian BaikeFramework
|
|
27
|
+
|
|
28
|
+
shidian.baike.com](https://shidian.baike.com/)[XiaoheFramework
|
|
29
|
+
|
|
30
|
+
xiaohe.cn](https://xiaohe.cn/)[DongchediBuilder
|
|
31
|
+
|
|
32
|
+
m.dcdapp.com](https://m.dcdapp.com/motor/feoffline/usedcar_channel/channel.html)[Volcengine DeveloperFramework
|
|
33
|
+
|
|
34
|
+
developer.volcengine.com](https://developer.volcengine.com/)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Meet the Team
|
|
2
|
+
|
|
3
|
+
The development of Modern.js is driven by ByteDance's Modern.js team and community contributors.
|
|
4
|
+
|
|
5
|
+
## Core Team Members
|
|
6
|
+
|
|
7
|
+
The Modern.js core team members:
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## All Contributors
|
|
11
|
+
|
|
12
|
+
Thanks to the following friends for their contributions to Modern.js:
|
|
13
|
+
|
|
14
|
+
[](https://github.com/web-infra-dev/modern.js/graphs/contributors)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# bff.crossProject
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
:::tip
|
|
7
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
This configuration is used to enable BFF cross-project invocation functionality. When enabled, the current project can be used as a BFF producer, generating an SDK that can be directly called by other projects.
|
|
11
|
+
|
|
12
|
+
```ts title="modern.config.ts"
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
bff: {
|
|
15
|
+
crossProject: true,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For detailed configuration and usage of BFF cross-project invocation, please refer to the [BFF Cross-Project Invocation Guide](/guides/advanced-features/bff/cross-project.md).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# bff.prefix
|
|
2
|
+
|
|
3
|
+
- **Type:** `string`
|
|
4
|
+
- **Default:** `/api`
|
|
5
|
+
|
|
6
|
+
:::tip
|
|
7
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
By default, the prefix for accessing routes in the BFF API directory is `/api`, as shown in the following directory structure:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
api
|
|
14
|
+
└── hello.ts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The route corresponding to `api/hello.ts` when accessed is `localhost:8080/api/hello`.
|
|
18
|
+
|
|
19
|
+
This configuration option can modify the default route prefix:
|
|
20
|
+
|
|
21
|
+
```ts title="modern.config.ts"
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
bff: {
|
|
24
|
+
prefix: '/api-demo',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The corresponding route for `api/hello.ts` when accessed is `localhost:8080/api-demo/hello`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# builderPlugins
|
|
2
|
+
|
|
3
|
+
- **Type:** `RsbuildPlugin[]`
|
|
4
|
+
- **Default:** `[]`
|
|
5
|
+
|
|
6
|
+
Used to configure the Rsbuild plugin.
|
|
7
|
+
|
|
8
|
+
Rsbuild is the build tool of Modern.js, please read [Build Engine](/guides/concept/builder.md) for background. If you want to know how to write Rsbuild plugins, you can refer to [Rsbuild - Plugin System](https://v2.rsbuild.rs/plugins/dev/index).
|
|
9
|
+
|
|
10
|
+
## Precautions
|
|
11
|
+
|
|
12
|
+
This option **is used to configure the Rsbuild plugins**. If you need to configure other types of plugins, please select the corresponding configs:
|
|
13
|
+
|
|
14
|
+
- Use [plugins](/configure/app/plugins.md) to configure Modern.js framework plugins.
|
|
15
|
+
- Use [tools.bundlerChain](/configure/app/tools/bundler-chain.md) to configure Rspack plugins.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
In most scenarios, we recommend you to use the Modern.js framework plugin, which can be registered through the [plugins](/configure/app/plugins.md) config. Because the API provided by the framework plugin is richer and more capable, while the API provided by the Rsbuild plugin can only be used to build scenes.
|
|
20
|
+
|
|
21
|
+
When you need to reference some existing Rsbuild plugins (and there is no related capability in Modern.js), or reuse Rsbuild plugins between different frameworks, you can use the `builderPlugins` field to register them.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
Below is an example of using the Rsbuild plugin.
|
|
26
|
+
|
|
27
|
+
### Using plugins on npm
|
|
28
|
+
|
|
29
|
+
To use a plugin on npm, you need to install the plugin through the package manager and import it.
|
|
30
|
+
|
|
31
|
+
```ts title="modern.config.ts"
|
|
32
|
+
import myRsbuildPlugin from 'my-rsbuild-plugin';
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
builderPlugins: [myRsbuildPlugin()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Using local plugins
|
|
40
|
+
|
|
41
|
+
Use the plugin in the local code repository, you can import it directly through the relative path import.
|
|
42
|
+
|
|
43
|
+
```ts title="modern.config.ts"
|
|
44
|
+
import myRsbuildPlugin from './plugin/myRsbuildPlugin';
|
|
45
|
+
|
|
46
|
+
export default defineConfig({
|
|
47
|
+
builderPlugins: [myRsbuildPlugin()],
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Plugin configuration options
|
|
52
|
+
|
|
53
|
+
If the plugin provides some custom configuration options, you can pass in the configuration through the parameters of the plugin function.
|
|
54
|
+
|
|
55
|
+
```ts title="modern.config.ts"
|
|
56
|
+
import myRsbuildPlugin from 'my-rsbuild-plugin';
|
|
57
|
+
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
builderPlugins: [
|
|
60
|
+
myRsbuildPlugin({
|
|
61
|
+
foo: 1,
|
|
62
|
+
bar: 2,
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# dev.assetPrefix
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean | string | 'auto'`
|
|
4
|
+
- **Default:** `'/'`
|
|
5
|
+
|
|
6
|
+
This configuration item is used to set the URL prefix of static resources in **development mode**.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.assetPrefix](https://v2.rsbuild.dev/config/dev/asset-prefix).
|
|
10
|
+
:::
|
|
11
|
+
:::warning
|
|
12
|
+
Please note that this configuration item is only applicable in development mode. In production mode, please use the [output.assetPrefix](/configure/app/output/asset-prefix.md) configuration item for setting.
|
|
13
|
+
:::
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# dev.beforeStartUrl
|
|
2
|
+
|
|
3
|
+
- **Type:** `() => Promise<void> | void`
|
|
4
|
+
- **Default:** `undefined`
|
|
5
|
+
|
|
6
|
+
`dev.beforeStartUrl` is used to execute a callback function before opening the `startUrl`, this config needs to be used together with `dev.startUrl`.
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
export default {
|
|
10
|
+
dev: {
|
|
11
|
+
startUrl: true,
|
|
12
|
+
beforeStartUrl: async () => {
|
|
13
|
+
await doSomeThing();
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# dev.client
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type Client = {
|
|
7
|
+
// The protocol name for the WebSocket request
|
|
8
|
+
protocol?: 'ws' | 'wss';
|
|
9
|
+
// The path for the WebSocket request
|
|
10
|
+
path?: string;
|
|
11
|
+
// The port number for the WebSocket request
|
|
12
|
+
port?: string | number;
|
|
13
|
+
// The host for the WebSocket request
|
|
14
|
+
host?: string;
|
|
15
|
+
// The maximum number of reconnection attempts after a WebSocket request is disconnected.
|
|
16
|
+
reconnect?: number;
|
|
17
|
+
// Whether to display an error overlay in the browser when a compilation error occurs
|
|
18
|
+
overlay?: boolean;
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **Default:**
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const defaultConfig = {
|
|
26
|
+
path: '/webpack-hmr',
|
|
27
|
+
port: '<port>',
|
|
28
|
+
// By default it is set to "location.hostname"
|
|
29
|
+
host: '',
|
|
30
|
+
// By default it is set to "location.protocol === 'https:' ? 'wss' : 'ws'""
|
|
31
|
+
protocol: undefined,
|
|
32
|
+
reconnect: 100,
|
|
33
|
+
overlay: false,
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Configure the client code injected by Modern.js during the development process. This can be used to set the WebSocket URL for HMR.
|
|
38
|
+
|
|
39
|
+
:::info
|
|
40
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.client](https://v2.rsbuild.dev/config/dev/client).
|
|
41
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dev.hmr
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `true`
|
|
5
|
+
|
|
6
|
+
Whether to enable Hot Module Replacement.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.hmr](https://v2.rsbuild.dev/config/dev/hmr).
|
|
10
|
+
:::
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# dev.host
|
|
2
|
+
|
|
3
|
+
- **Type:** `string`
|
|
4
|
+
- **Default:** `0.0.0.0`
|
|
5
|
+
|
|
6
|
+
Specify the host that the dev server listens to.
|
|
7
|
+
|
|
8
|
+
By default, the dev server will listen to `0.0.0.0`, which means listening to all network interfaces, including `localhost` and public network addresses.
|
|
9
|
+
|
|
10
|
+
If you want the dev server to listen only on `localhost`, you can set it to:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
export default {
|
|
14
|
+
dev: {
|
|
15
|
+
host: 'localhost',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# dev.https
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean | { key: string; cert: string }`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server.
|
|
7
|
+
|
|
8
|
+
HTTP:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
> Local: http://localhost:8080/
|
|
12
|
+
> Network: http://192.168.0.1:8080/
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
HTTPS:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
> Local: https://localhost:8080/
|
|
19
|
+
> Network: https://192.168.0.1:8080/
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### Automatically generate certificates
|
|
23
|
+
|
|
24
|
+
You can directly set `https` to `true`, Modern.js will automatically generate the HTTPS certificate based on [devcert](https://github.com/davewasmer/devcert).
|
|
25
|
+
|
|
26
|
+
When using this method, you need to manually install the [devcert](https://github.com/davewasmer/devcert) dependency in your project:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# npm
|
|
30
|
+
npm install devcert@1.2.2 -D
|
|
31
|
+
|
|
32
|
+
# yarn
|
|
33
|
+
yarn add devcert@1.2.2 -D
|
|
34
|
+
|
|
35
|
+
# pnpm
|
|
36
|
+
pnpm add devcert@1.2.2 -D
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then configure `dev.https` to `true`:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
export default {
|
|
43
|
+
dev: {
|
|
44
|
+
https: true,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The devcert has some limitations, it does not currently support IP addresses yet.
|
|
50
|
+
|
|
51
|
+
:::tip
|
|
52
|
+
The https proxy automatically installs the certificate and needs root authority, please enter the password according to the prompt.
|
|
53
|
+
**The password is only used to trust the certificate, and will not be leaked or be used elsewhere**.
|
|
54
|
+
:::
|
|
55
|
+
|
|
56
|
+
#### Manually set the certificate
|
|
57
|
+
|
|
58
|
+
You can also manually pass in the certificate and the private key required in the `dev.https` option. This parameter will be directly passed to the createServer method of the https module in Node.js.
|
|
59
|
+
|
|
60
|
+
For details, please refer to [https.createServer](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener).
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import fs from 'fs';
|
|
64
|
+
|
|
65
|
+
export default {
|
|
66
|
+
dev: {
|
|
67
|
+
https: {
|
|
68
|
+
key: fs.readFileSync('certificates/private.pem'),
|
|
69
|
+
cert: fs.readFileSync('certificates/public.pem'),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Clean up cert cache
|
|
76
|
+
|
|
77
|
+
The certificate created by devcert is saved in `~/Library/Application\ Support/devcert`. You may do some cleanup if needed.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# dev.lazyCompilation
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type LazyCompilationOptions =
|
|
7
|
+
| boolean
|
|
8
|
+
| {
|
|
9
|
+
/**
|
|
10
|
+
* Enable lazy compilation for entries.
|
|
11
|
+
*/
|
|
12
|
+
entries?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Enable lazy compilation for dynamic imports.
|
|
15
|
+
*/
|
|
16
|
+
imports?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Specify which imported modules should be lazily compiled.
|
|
19
|
+
*/
|
|
20
|
+
test?: RegExp | ((m: Module) => boolean);
|
|
21
|
+
/**
|
|
22
|
+
* The path to a custom runtime code that overrides the default lazy compilation client.
|
|
23
|
+
*/
|
|
24
|
+
client?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Tells the client the server URL that needs to be requested.
|
|
27
|
+
*/
|
|
28
|
+
serverUrl?: string;
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Default:** `false`
|
|
33
|
+
|
|
34
|
+
Enable lazy compilation (compilation on demand), implemented based on Rspack's [lazy compilation](https://rspack.rs/guide/features/lazy-compilation) feature.
|
|
35
|
+
|
|
36
|
+
:::info
|
|
37
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.lazyCompilation](https://v2.rsbuild.dev/config/dev/lazy-compilation)。
|
|
38
|
+
In Rspack build mode,
|
|
39
|
+
:::
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dev.liveReload
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `true`
|
|
5
|
+
|
|
6
|
+
Whether to reload the page when source files are changed.
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.liveReload](https://v2.rsbuild.dev/config/dev/live-reload).
|
|
10
|
+
:::
|