@modern-js/main-doc 3.0.1 → 3.0.2

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.
Files changed (65) hide show
  1. package/docs/en/_nav.json +1 -1
  2. package/docs/en/apis/app/commands.mdx +1 -1
  3. package/docs/en/community/blog/_meta.json +7 -1
  4. package/docs/en/community/blog/v3-release-note.mdx +625 -0
  5. package/docs/en/components/rsbuild.mdx +1 -1
  6. package/docs/en/configure/app/builder-plugins.mdx +1 -1
  7. package/docs/en/configure/app/dev/server.mdx +6 -6
  8. package/docs/en/configure/app/resolve/alias-strategy.mdx +1 -1
  9. package/docs/en/configure/app/resolve/dedupe.mdx +1 -1
  10. package/docs/en/configure/app/security/sri.mdx +1 -1
  11. package/docs/en/configure/app/server/rsc.mdx +2 -2
  12. package/docs/en/configure/app/source/decorators.mdx +1 -1
  13. package/docs/en/configure/app/tools/bundler-chain.mdx +1 -1
  14. package/docs/en/configure/app/tools/swc.mdx +2 -2
  15. package/docs/en/guides/advanced-features/compatibility.mdx +1 -1
  16. package/docs/en/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
  17. package/docs/en/guides/basic-features/css/css.mdx +4 -4
  18. package/docs/en/guides/basic-features/css/tailwindcss.mdx +2 -2
  19. package/docs/en/guides/basic-features/render/rsc.mdx +137 -8
  20. package/docs/en/guides/concept/builder.mdx +3 -3
  21. package/docs/en/guides/get-started/tech-stack.mdx +3 -3
  22. package/docs/en/guides/topic-detail/module-federation/application.mdx +6 -6
  23. package/docs/en/guides/topic-detail/module-federation/deploy.mdx +2 -2
  24. package/docs/en/guides/topic-detail/module-federation/i18n.mdx +12 -12
  25. package/docs/en/guides/topic-detail/module-federation/introduce.mdx +1 -1
  26. package/docs/en/guides/topic-detail/module-federation/ssr.mdx +4 -4
  27. package/docs/en/guides/topic-detail/module-federation/usage.mdx +7 -7
  28. package/docs/en/guides/troubleshooting/builder.mdx +4 -4
  29. package/docs/en/guides/upgrade/config.mdx +31 -3
  30. package/docs/en/plugin/cli-plugins/api.mdx +9 -9
  31. package/docs/en/plugin/introduction.mdx +5 -5
  32. package/docs/zh/_nav.json +1 -1
  33. package/docs/zh/apis/app/commands.mdx +1 -1
  34. package/docs/zh/community/blog/_meta.json +7 -1
  35. package/docs/zh/community/blog/v3-release-note.mdx +626 -0
  36. package/docs/zh/components/rsbuild.mdx +1 -1
  37. package/docs/zh/configure/app/builder-plugins.mdx +1 -1
  38. package/docs/zh/configure/app/dev/server.mdx +6 -6
  39. package/docs/zh/configure/app/resolve/alias-strategy.mdx +1 -1
  40. package/docs/zh/configure/app/resolve/dedupe.mdx +1 -1
  41. package/docs/zh/configure/app/security/sri.mdx +1 -1
  42. package/docs/zh/configure/app/server/rsc.mdx +2 -2
  43. package/docs/zh/configure/app/source/decorators.mdx +1 -1
  44. package/docs/zh/configure/app/tools/bundler-chain.mdx +1 -1
  45. package/docs/zh/configure/app/tools/swc.mdx +2 -2
  46. package/docs/zh/guides/advanced-features/compatibility.mdx +1 -1
  47. package/docs/zh/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
  48. package/docs/zh/guides/basic-features/css/css.mdx +4 -4
  49. package/docs/zh/guides/basic-features/css/tailwindcss.mdx +2 -2
  50. package/docs/zh/guides/basic-features/render/rsc.mdx +222 -8
  51. package/docs/zh/guides/concept/builder.mdx +3 -3
  52. package/docs/zh/guides/get-started/tech-stack.mdx +3 -3
  53. package/docs/zh/guides/topic-detail/module-federation/application.mdx +6 -6
  54. package/docs/zh/guides/topic-detail/module-federation/deploy.mdx +2 -2
  55. package/docs/zh/guides/topic-detail/module-federation/i18n.mdx +12 -12
  56. package/docs/zh/guides/topic-detail/module-federation/introduce.mdx +1 -1
  57. package/docs/zh/guides/topic-detail/module-federation/ssr.mdx +4 -4
  58. package/docs/zh/guides/topic-detail/module-federation/usage.mdx +7 -7
  59. package/docs/zh/guides/troubleshooting/builder.mdx +4 -4
  60. package/docs/zh/guides/upgrade/config.mdx +31 -3
  61. package/docs/zh/plugin/cli-plugins/api.mdx +9 -9
  62. package/docs/zh/plugin/introduction.mdx +5 -5
  63. package/package.json +2 -2
  64. package/src/components/RsbuildLink/index.tsx +1 -1
  65. package/src/pages/index.tsx +1 -1
@@ -1,6 +1,6 @@
1
1
  # Getting Started
2
2
 
3
- To use Module Federation in Modern.js, we recommend using the official plugin `@module-federation/modern-js`.
3
+ To use Module Federation in Modern.js, we recommend using the official plugin `@module-federation/modern-js-v3`.
4
4
 
5
5
  This section will introduce how to set up both producer and consumer applications using the official plugin. First, create two applications by following the [Modern.js Quick Start](/guides/get-started/quick-start).
6
6
 
@@ -10,7 +10,7 @@ After creating the applications, install the plugin for both projects:
10
10
 
11
11
  import { PackageManagerTabs } from '@theme';
12
12
 
13
- <PackageManagerTabs command="add @module-federation/modern-js" />
13
+ <PackageManagerTabs command="add @module-federation/modern-js-v3" />
14
14
 
15
15
  ## Register the Plugin
16
16
 
@@ -18,7 +18,7 @@ After installing the plugin, you need to register it in the `modern.config.js` f
18
18
 
19
19
  ```ts
20
20
  import { appTools, defineConfig } from '@modern-js/app-tools';
21
- import { moduleFederationPlugin } from '@module-federation/modern-js';
21
+ import { moduleFederationPlugin } from '@module-federation/modern-js-v3';
22
22
 
23
23
  export default defineConfig({
24
24
  plugins: [appTools(), moduleFederationPlugin()],
@@ -42,7 +42,7 @@ export const Button = () => {
42
42
  Then, add the `module-federation.config.ts` file at the project root to configure the Module Federation module's name, shared dependencies, and exports:
43
43
 
44
44
  ```ts title="module-federation.config.ts"
45
- import { createModuleFederationConfig } from '@module-federation/modern-js';
45
+ import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
46
46
 
47
47
  export default createModuleFederationConfig({
48
48
  name: 'remote',
@@ -68,7 +68,7 @@ Additionally, modify `modern.config.ts` to provide a development environment por
68
68
 
69
69
  ```ts title="modern.config.ts"
70
70
  import { appTools, defineConfig } from '@modern-js/app-tools';
71
- import { moduleFederationPlugin } from '@module-federation/modern-js';
71
+ import { moduleFederationPlugin } from '@module-federation/modern-js-v3';
72
72
 
73
73
  export default defineConfig({
74
74
  server: {
@@ -85,7 +85,7 @@ Now, modify the consumer's code to use the module exported by the producer.
85
85
  Add the `module-federation.config.ts` file at the project root to configure the Module Federation module's name, shared dependencies, and the remote module to use:
86
86
 
87
87
  ```ts title="module-federation.config.ts"
88
- import { createModuleFederationConfig } from '@module-federation/modern-js';
88
+ import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
89
89
 
90
90
  export default createModuleFederationConfig({
91
91
  name: 'host',
@@ -172,7 +172,7 @@ If we want to simulate the production environment in local, but not configure `o
172
172
 
173
173
  ```ts
174
174
  import { appTools, defineConfig } from '@modern-js/app-tools';
175
- import { moduleFederationPlugin } from '@module-federation/modern-js';
175
+ import { moduleFederationPlugin } from '@module-federation/modern-js-v3';
176
176
 
177
177
  // https://modernjs.dev/en/configure/app/usage
178
178
  export default defineConfig({
@@ -10,11 +10,11 @@ If you encounter any build-related issues, you can refer to the current document
10
10
 
11
11
  ### Rsbuild FAQ
12
12
 
13
- Modern.js is internally based on [Rsbuild](https://rsbuild.rs/) and encapsulates its own build tool, so you can directly refer to the FAQ document of Rsbuild:
13
+ Modern.js is internally based on [Rsbuild](https://v2.rsbuild.dev/) and encapsulates its own build tool, so you can directly refer to the FAQ document of Rsbuild:
14
14
 
15
- - [Rsbuild - Features FAQ](https://rsbuild.rs/guide/faq/features)
16
- - [Rsbuild - Exceptions FAQ](https://rsbuild.rs/guide/faq/exceptions)
17
- - [Rsbuild - HMR FAQ](https://rsbuild.rs/guide/faq/hmr)
15
+ - [Rsbuild - Features FAQ](https://v2.rsbuild.dev/guide/faq/features)
16
+ - [Rsbuild - Exceptions FAQ](https://v2.rsbuild.dev/guide/faq/exceptions)
17
+ - [Rsbuild - HMR FAQ](https://v2.rsbuild.dev/guide/faq/hmr)
18
18
 
19
19
  ---
20
20
 
@@ -151,12 +151,40 @@ export default {
151
151
 
152
152
  ## tools
153
153
 
154
+ ### toos.postcss
155
+
156
+ **Change**: The object configuration will override the built-in PostCSS configuration of Modern.js. If you need to extend based on the built-in configuration, please use the function configuration.
157
+
158
+ ```typescript
159
+ // v2
160
+ export default {
161
+ tools: {
162
+ postcss: {
163
+ postcssOptions: {
164
+ plugins: [tailwindcssPlugin],
165
+ },
166
+ },
167
+ },
168
+ };
169
+ ```
170
+
171
+ ```typescript
172
+ // v3
173
+ export default {
174
+ tools: {
175
+ postcss: (opts, { addPlugins }) => {
176
+ addPlugins(tailwindcssPlugin);
177
+ },
178
+ },
179
+ };
180
+ ```
181
+
154
182
  ### tools.esbuild
155
183
 
156
184
  **Change**: This configuration has been deprecated, you need to manually switch to esbuild minification.
157
185
 
158
186
  ```typescript
159
- // This configuration has been deprecated, please refer to [Switching Minifier](https://rsbuild.rs/config/output/minify#switching-minifier) to manually switch to esbuild minification
187
+ // This configuration has been deprecated, please refer to [Switching Minifier](https://v2.rsbuild.dev/config/output/minify#switching-minifier) to manually switch to esbuild minification
160
188
  // tools: {
161
189
  // esbuild: { /* configuration */ }
162
190
  // },
@@ -167,7 +195,7 @@ export default {
167
195
  **Change**: This configuration has been deprecated, you need to manually switch to Terser minification.
168
196
 
169
197
  ```typescript
170
- // This configuration has been deprecated, please refer to [Switching Minifier](https://rsbuild.rs/config/output/minify#switching-minifier) to manually switch to Terser minification
198
+ // This configuration has been deprecated, please refer to [Switching Minifier](https://v2.rsbuild.dev/config/output/minify#switching-minifier) to manually switch to Terser minification
171
199
  // tools: {
172
200
  // terser: { /* configuration */ }
173
201
  // },
@@ -889,7 +917,7 @@ export default defineRuntimeConfig({
889
917
 
890
918
  ### performance.bundleAnalyze
891
919
 
892
- **Change**: This configuration has been deprecated, it is recommended to use [Rsdoctor](https://rsbuild.rs/guide/debug/rsdoctor) to analyze bundle size.
920
+ **Change**: This configuration has been deprecated, it is recommended to use [Rsdoctor](https://v2.rsbuild.dev/guide/debug/rsdoctor) to analyze bundle size.
893
921
 
894
922
  ### performance.transformLodash
895
923
 
@@ -192,7 +192,7 @@ Modify Rspack configuration using the chain API.
192
192
  - **Parameters:**
193
193
  - `modifyFn`: A modification function that receives a `RspackChain` instance and utility functions as parameters.
194
194
  - **Execution Phase:** When generating the final Rspack configuration.
195
- - **Corresponding Rsbuild Hook:** [modifyBundlerChain](https://rsbuild.rs/en/plugins/dev/hooks#modifybundlerchain)
195
+ - **Corresponding Rsbuild Hook:** [modifyBundlerChain](https://v2.rsbuild.dev/plugins/dev/hooks#modifybundlerchain)
196
196
  - **Example:**
197
197
 
198
198
  ```typescript
@@ -212,7 +212,7 @@ Modify the Rsbuild configuration.
212
212
  - **Parameters:**
213
213
  - `modifyFn`: A modification function that receives the Rsbuild configuration object and utility functions as parameters. It can return the modified configuration object, a Promise, or nothing (modifying the original object directly).
214
214
  - **Execution Phase:** When generating the final Rsbuild configuration.
215
- - **Corresponding Rsbuild Hook:** [modifyRsbuildConfig](https://rsbuild.rs/en/plugins/dev/hooks#modifyrsbuildconfig)
215
+ - **Corresponding Rsbuild Hook:** [modifyRsbuildConfig](https://v2.rsbuild.dev/plugins/dev/hooks#modifyrsbuildconfig)
216
216
  - **Example:**
217
217
 
218
218
  ```typescript
@@ -232,7 +232,7 @@ Modify the Rspack configuration (when using Rspack as the bundler).
232
232
  - **Parameters:**
233
233
  - `modifyFn`: A modification function that receives the Rspack configuration object and utility functions as parameters. It can return the modified configuration object, a Promise, or nothing (modifying the original object directly).
234
234
  - **Execution Phase:** When generating the final Rspack configuration.
235
- - **Corresponding Rsbuild Hook:** [modifyRspackConfig](https://rsbuild.rs/en/plugins/dev/hooks#modifyrspackconfig)
235
+ - **Corresponding Rsbuild Hook:** [modifyRspackConfig](https://v2.rsbuild.dev/plugins/dev/hooks#modifyrspackconfig)
236
236
  - **Example:**
237
237
 
238
238
  ```typescript
@@ -407,7 +407,7 @@ Add additional logic before the build starts.
407
407
  - **Parameters:**
408
408
  - `buildFn`: A function to be executed before the build, without parameters, can be asynchronous.
409
409
  - **Execution Phase:** Before executing the build process.
410
- - **Corresponding Rsbuild Hook:** [onBeforeBuild](https://rsbuild.rs/en/plugins/dev/hooks#onbeforebuild)
410
+ - **Corresponding Rsbuild Hook:** [onBeforeBuild](https://v2.rsbuild.dev/plugins/dev/hooks#onbeforebuild)
411
411
  - **Example:**
412
412
 
413
413
  ```typescript
@@ -426,7 +426,7 @@ Add additional logic after the build is complete.
426
426
  - **Parameters:**
427
427
  - `buildFn`: A function to be executed after the build, without parameters, can be asynchronous.
428
428
  - **Execution Phase:** After executing the build process.
429
- - **Corresponding Rsbuild Hook:** [onAfterBuild](https://rsbuild.rs/en/plugins/dev/hooks#onafterbuild)
429
+ - **Corresponding Rsbuild Hook:** [onAfterBuild](https://v2.rsbuild.dev/plugins/dev/hooks#onafterbuild)
430
430
  - **Example:**
431
431
 
432
432
  ```typescript
@@ -445,7 +445,7 @@ Add additional logic after the development server compilation is complete.
445
445
  - **Parameters:**
446
446
  - `compileFn`: A function to be executed after compilation is complete.
447
447
  - **Execution Phase:** After the development server starts and the initial compilation is complete.
448
- - **Corresponding Rsbuild Hook:** [onDevCompileDone](https://rsbuild.rs/en/plugins/dev/hooks#ondevcompiledone)
448
+ - **Corresponding Rsbuild Hook:** [onDevCompileDone](https://v2.rsbuild.dev/plugins/dev/hooks#ondevcompiledone)
449
449
  - **Example:**
450
450
 
451
451
  ```typescript
@@ -464,7 +464,7 @@ Add additional logic before creating the compiler instance.
464
464
  - **Parameters:**
465
465
  - `createFn`: A function to be executed before creation, without parameters, can be asynchronous.
466
466
  - **Execution Phase:** Before creating the Rspack compiler instance.
467
- - **Corresponding Rsbuild Hook:** [onBeforeCreateCompiler](https://rsbuild.rs/en/plugins/dev/hooks#onbeforecreatecompiler)
467
+ - **Corresponding Rsbuild Hook:** [onBeforeCreateCompiler](https://v2.rsbuild.dev/plugins/dev/hooks#onbeforecreatecompiler)
468
468
  - **Example:**
469
469
 
470
470
  ```typescript
@@ -483,7 +483,7 @@ Add additional logic after creating the compiler instance.
483
483
  - **Parameters:**
484
484
  - `createFn`: A function to be executed after creation, without parameters, can be asynchronous.
485
485
  - **Execution Phase:** After creating the Rspack compiler instance.
486
- - **Corresponding Rsbuild Hook:** [onAfterCreateCompiler](https://rsbuild.rs/en/plugins/dev/hooks#onaftercreatecompiler)
486
+ - **Corresponding Rsbuild Hook:** [onAfterCreateCompiler](https://v2.rsbuild.dev/plugins/dev/hooks#onaftercreatecompiler)
487
487
  - **Example:**
488
488
 
489
489
  ```typescript
@@ -521,7 +521,7 @@ Add additional logic after starting the development server.
521
521
  - **Parameters:**
522
522
  - `devFn`: A function to be executed after the development server starts.
523
523
  - **Execution Phase:** After the development server has successfully started.
524
- - **Corresponding Rsbuild Hook:** [onAfterStartDevServer](https://rsbuild.rs/en/plugins/dev/hooks#onafterstartdevserver)
524
+ - **Corresponding Rsbuild Hook:** [onAfterStartDevServer](https://v2.rsbuild.dev/plugins/dev/hooks#onafterstartdevserver)
525
525
  - **Example:**
526
526
 
527
527
  ```typescript
@@ -117,7 +117,7 @@ Rsbuild is the underlying build tool for Modern.js. By adding Rsbuild plugins, y
117
117
  You can register Rsbuild plugins in `modern.config.ts` via the `builderPlugins` option. See [builderPlugins](/configure/app/builder-plugins.html) for details.
118
118
 
119
119
  :::info
120
- You can read [Rsbuild Official Website - Plugins](https://rsbuild.rs/plugins/list/index) to learn more about the Rsbuild plugin system.
120
+ You can read [Rsbuild Official Website - Plugins](https://v2.rsbuild.dev/plugins/list/index) to learn more about the Rsbuild plugin system.
121
121
  :::
122
122
 
123
123
  ### Official Plugins
@@ -128,9 +128,9 @@ The following are official Rsbuild plugins that are already built into Modern.js
128
128
 
129
129
  | Plugin | Description | Modern.js Link |
130
130
  | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
131
- | [React Plugin](https://rsbuild.rs/plugins/list/plugin-react) | Provides support for React | - |
132
- | [SVGR Plugin](https://rsbuild.rs/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [output.disableSvgr](/configure/app/output/disable-svgr)<br />[output.svgDefaultExport](/configure/app/output/svg-default-export) |
133
- | [Assets Retry Plugin](https://rsbuild.rs/plugins/list/plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.html) |
131
+ | [React Plugin](https://v2.rsbuild.dev/plugins/list/plugin-react) | Provides support for React | - |
132
+ | [SVGR Plugin](https://v2.rsbuild.dev/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [output.disableSvgr](/configure/app/output/disable-svgr)<br />[output.svgDefaultExport](/configure/app/output/svg-default-export) |
133
+ | [Assets Retry Plugin](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.html) |
134
134
  | [Type Check Plugin](https://github.com/rspack-contrib/rsbuild-plugin-type-check) | Runs TypeScript type checking in a separate process | [output.disableTsChecker](/configure/app/output/disable-ts-checker.html)<br />[tools.tsChecker](/configure/app/tools/ts-checker.html) |
135
135
  | [Source Build Plugin](https://github.com/rspack-contrib/rsbuild-plugin-source-build) | For monorepo scenarios, supports referencing source code from other subdirectories and completing builds and hot updates | [experiments.sourceBuild](/configure/app/experiments/source-build.html) |
136
136
  | [Check Syntax Plugin](https://github.com/rspack-contrib/rsbuild-plugin-check-syntax) | Analyzes the syntax compatibility of the build artifacts to determine if there are any advanced syntax features that cause compatibility issues | [security.checkSyntax](/configure/app/security/check-syntax.html) |
@@ -142,7 +142,7 @@ The following are official Rsbuild plugins that are already built into Modern.js
142
142
  The following are official Rsbuild plugins that are not built into Modern.js:
143
143
 
144
144
  - [Image Compress Plugin](https://github.com/rspack-contrib/rsbuild-plugin-image-compress): Compresses image resources used in the project.
145
- - [Stylus Plugin](https://rsbuild.rs/plugins/list/plugin-stylus): Uses Stylus as the CSS preprocessor.
145
+ - [Stylus Plugin](https://v2.rsbuild.dev/plugins/list/plugin-stylus): Uses Stylus as the CSS preprocessor.
146
146
  - [UMD Plugin](https://github.com/rspack-contrib/rsbuild-plugin-umd): Used to build UMD format artifacts.
147
147
  - [YAML Plugin](https://github.com/rspack-contrib/rsbuild-plugin-yaml): Used to reference YAML files and convert them to JavaScript objects.
148
148
  - [TOML Plugin](https://github.com/rspack-contrib/rsbuild-plugin-toml): Used to reference TOML files and convert them to JavaScript objects.
package/docs/zh/_nav.json CHANGED
@@ -31,6 +31,6 @@
31
31
  },
32
32
  {
33
33
  "text": "Modern.js 2.x 文档",
34
- "link": "https://modernjs.dev/zh/guides/get-started/introduction.html"
34
+ "link": "https://modernjs.dev/v2/zh/"
35
35
  }
36
36
  ]
@@ -150,7 +150,7 @@ Options:
150
150
 
151
151
  ## modern inspect
152
152
 
153
- `modern inspect` 命令用于查看项目的 Modern.js 配置、[Rsbuild 配置](https://rsbuild.rs/zh/config/index) 以及 Rspack 配置。
153
+ `modern inspect` 命令用于查看项目的 Modern.js 配置、[Rsbuild 配置](https://v2.rsbuild.dev/zh/config/index) 以及 Rspack 配置。
154
154
 
155
155
  ```bash
156
156
  Usage: modern inspect [options]
@@ -1 +1,7 @@
1
- ["overview", "v2-release-note", "2022-0910-updates", "2022-0708-updates"]
1
+ [
2
+ "overview",
3
+ "v3-release-note.mdx",
4
+ "v2-release-note",
5
+ "2022-0910-updates",
6
+ "2022-0708-updates"
7
+ ]