@modern-js/main-doc 0.0.0-nightly-20240123170645 → 0.0.0-nightly-20240124170638

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.
@@ -195,7 +195,7 @@ Options:
195
195
 
196
196
  ## modern inspect
197
197
 
198
- The `modern inspect` command is used to view the [Modern.js Builder config](https://modernjs.dev/builder/en/guide/basic/builder-config.html) and webpack config of the project.
198
+ The `modern inspect` command is used to view the [Rsbuild config](https://rsbuild.dev/config/index) and webpack or Rspack config of the project.
199
199
 
200
200
  ```bash
201
201
  Usage: modern inspect [options]
@@ -210,16 +210,16 @@ Options:
210
210
 
211
211
  After executing the command `npx modern inspect` in the project root directory, the following files will be generated in the `dist` directory of the project:
212
212
 
213
- - `builder.config.js`: The Modern.js Builder config to use at build time.
214
- - `webpack.config.web.js`: The webpack config used by to use at build time.
213
+ - `rsbuild.config.mjs`: The Rsbuild config to use at build time.
214
+ - `webpack.config.web.mjs`: The webpack config used by to use at build time.
215
215
 
216
216
  ```bash
217
217
  ➜ npx modern inspect
218
218
 
219
219
  Inspect config succeed, open following files to view the content:
220
220
 
221
- - Builder Config: /root/my-project/dist/builder.config.js
222
- - Webpack Config (web): /root/my-project/dist/webpack.config.web.js
221
+ - Rsbuild Config: /root/my-project/dist/rsbuild.config.mjs
222
+ - Webpack Config (web): /root/my-project/dist/webpack.config.web.mjs
223
223
  ```
224
224
 
225
225
  ### Configuration Env
@@ -240,16 +240,16 @@ modern inspect --verbose
240
240
 
241
241
  ### SSR Configuration
242
242
 
243
- If the project has enabled SSR, an additional `webpack.config.node.js` file will be generated in the `dist/`, corresponding to the webpack configuration at SSR build time.
243
+ If the project has enabled SSR, an additional `webpack.config.node.mjs` file will be generated in the `dist/`, corresponding to the webpack configuration at SSR build time.
244
244
 
245
245
  ```bash
246
246
  ➜ npx modern inspect
247
247
 
248
248
  Inspect config succeed, open following files to view the content:
249
249
 
250
- - Builder Config: /root/my-project/dist/builder.config.js
251
- - Webpack Config (web): /root/my-project/dist/webpack.config.web.js
252
- - Webpack Config (node): /root/my-project/dist/webpack.config.node.js
250
+ - Rsbuild Config: /root/my-project/dist/rsbuild.config.mjs
251
+ - Webpack Config (web): /root/my-project/dist/webpack.config.web.mjs
252
+ - Webpack Config (node): /root/my-project/dist/webpack.config.node.mjs
253
253
  ```
254
254
 
255
255
  ## modern lint
@@ -4,16 +4,16 @@ sidebar_position: 21
4
4
 
5
5
  # builderPlugins
6
6
 
7
- - **Type:** `BuilderPlugin[]`
7
+ - **Type:** `RsbuildPlugin[]`
8
8
  - **Default:** `[]`
9
9
 
10
- Used to configure the Modern.js Builder plugin.
10
+ Used to configure the Rsbuild plugin.
11
11
 
12
- Modern.js Builder is the build tool of Modern.js, please read [Builder](/guides/concept/builder) for background. If you want to know how to write Builder plugins, you can refer to [Modern.js Builder - Introduce to Plugin](https://modernjs.dev/builder/en/plugins/introduction.html).
12
+ Rsbuild is the build tool of Modern.js, please read [Build Engine](/guides/concept/builder) for background. If you want to know how to write Rsbuild plugins, you can refer to [Rsbuild - Plugin System](https://rsbuild.dev/plugins/dev/index).
13
13
 
14
14
  ## Precautions
15
15
 
16
- This option **is used to configure the Modern.js Builder plugins**. If you need to configure other types of plugins, please select the corresponding configs:
16
+ This option **is used to configure the Rsbuild plugins**. If you need to configure other types of plugins, please select the corresponding configs:
17
17
 
18
18
  - Use [plugins](/configure/app/plugins) to configure Modern.js framework plugins.
19
19
  - Use [tools.bundlerChain](/configure/app/tools/bundler-chain) to configure Rspack or webpack plugins.
@@ -21,23 +21,23 @@ This option **is used to configure the Modern.js Builder plugins**. If you need
21
21
 
22
22
  ## When to use
23
23
 
24
- In most scenarios, we recommend you to use the Modern.js framework plugin, which can be registered through the [plugins](/configure/app/plugins) config. Because the API provided by the framework plugin is richer and more capable, while the API provided by the Builder plugin can only be used to build scenes.
24
+ In most scenarios, we recommend you to use the Modern.js framework plugin, which can be registered through the [plugins](/configure/app/plugins) config. Because the API provided by the framework plugin is richer and more capable, while the API provided by the Rsbuild plugin can only be used to build scenes.
25
25
 
26
- When you need to reference some existing Builder plugins (and there is no related capability in Modern.js), or reuse Builder plugins between different frameworks, you can use the `builderPlugins` field to register them.
26
+ 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.
27
27
 
28
28
  ## Example
29
29
 
30
- Below is an example of using the Builder plugin.
30
+ Below is an example of using the Rsbuild plugin.
31
31
 
32
32
  ### Using plugins on npm
33
33
 
34
34
  To use a plugin on npm, you need to install the plugin through the package manager and import it.
35
35
 
36
36
  ```ts title="modern.config.ts"
37
- import myBuilderPlugin from 'my-builder-plugin';
37
+ import myRsbuildPlugin from 'my-rsbuild-plugin';
38
38
 
39
39
  export default defineConfig({
40
- builderPlugins: [myBuilderPlugin()],
40
+ builderPlugins: [myRsbuildPlugin()],
41
41
  });
42
42
  ```
43
43
 
@@ -46,10 +46,10 @@ export default defineConfig({
46
46
  Use the plugin in the local code repository, you can import it directly through the relative path import.
47
47
 
48
48
  ```ts title="modern.config.ts"
49
- import myBuilderPlugin from './plugin/myBuilderPlugin';
49
+ import myRsbuildPlugin from './plugin/myRsbuildPlugin';
50
50
 
51
51
  export default defineConfig({
52
- builderPlugins: [myBuilderPlugin()],
52
+ builderPlugins: [myRsbuildPlugin()],
53
53
  });
54
54
  ```
55
55
 
@@ -58,11 +58,11 @@ export default defineConfig({
58
58
  If the plugin provides some custom configuration options, you can pass in the configuration through the parameters of the plugin function.
59
59
 
60
60
  ```ts title="modern.config.ts"
61
- import myBuilderPlugin from 'my-builder-plugin';
61
+ import myRsbuildPlugin from 'my-rsbuild-plugin';
62
62
 
63
63
  export default defineConfig({
64
64
  builderPlugins: [
65
- myBuilderPlugin({
65
+ myRsbuildPlugin({
66
66
  foo: 1,
67
67
  bar: 2,
68
68
  }),
@@ -19,4 +19,4 @@ export default defineConfig({
19
19
  });
20
20
  ```
21
21
 
22
- This config is implemented based on the Node Polyfill plugin of Modern.js Builder, you can read [Modern.js Builder - Node Polyfill Plugin](https://modernjs.dev/builder/en/plugins/plugin-node-polyfill.html) documentation for details.
22
+ This config is implemented based on the Node Polyfill plugin of Rsbuild, you can read [Rsbuild - Node Polyfill Plugin](https://rsbuild.dev/plugins/list/plugin-node-polyfill) documentation for details.
@@ -19,7 +19,7 @@ ios_saf >= 10
19
19
  ```
20
20
 
21
21
  :::tip
22
- Please refer to [Modern.js Builder - Browserslist](https://modernjs.dev/builder/en/guide/advanced/browserslist) for more information.
22
+ Please refer to [Rsbuild - Browserslist](https://rsbuild.dev/guide/advanced/browserslist) for more information.
23
23
  :::
24
24
 
25
25
  ## Polyfill
@@ -4,7 +4,7 @@ sidebar_position: 13
4
4
 
5
5
  # Bundle Size Optimization
6
6
 
7
- Bundle size optimization is an important part in production environment because it directly affects the user experience of online users. In this document, we will introduce some common bundle size optimization methods in Builder.
7
+ Bundle size optimization is an important part in production environment because it directly affects the user experience of online users. In this document, we will introduce some common bundle size optimization methods in Modern.js.
8
8
 
9
9
  ## Reduce duplicate dependencies
10
10
 
@@ -59,7 +59,7 @@ For example, if you only need to be compatible with browsers above Chrome 61, yo
59
59
  ```
60
60
 
61
61
  :::tip
62
- Please read the [Browserslist](https://modernjs.dev/builder/en/guide/advanced/browserslist.html) chapter to know more about the usage of Browserslist.
62
+ Please read the [Browserslist](https://rsbuild.dev/guide/advanced/browserslist) chapter to know more about the usage of Browserslist.
63
63
  :::
64
64
 
65
65
  ## Usage polyfill
@@ -82,23 +82,23 @@ Please read the [Browser Compatibility](/guides/advanced-features/compatibility)
82
82
 
83
83
  ## Image Compression
84
84
 
85
- In general front-end projects, the size of image often accounts for a large proportion of the total bundle size of the project.So if the image size can be reduced as much as possible, it will have a significant optimization effect on the project bundle size. You can enable image compression by registering a plugin in the Builder:
85
+ In general front-end projects, the size of image often accounts for a large proportion of the total bundle size of the project.So if the image size can be reduced as much as possible, it will have a significant optimization effect on the project bundle size. You can enable image compression by registering a plugin in Modern.js:
86
86
 
87
87
  ```ts title="modern.config.ts"
88
- import { builderPluginImageCompress } from '@modern-js/builder-plugin-image-compress';
88
+ import { pluginImageCompress } from '@rsbuild/plugin-image-compress';
89
89
 
90
90
  export default {
91
- builderPlugins: [builderPluginImageCompress()],
91
+ builderPlugins: [pluginImageCompress()],
92
92
  };
93
93
  ```
94
94
 
95
- See details in [plugin-image-compress](https://modernjs.dev/builder/en/plugins/plugin-image-compress.html).
95
+ See details in [plugin-image-compress](https://rsbuild.dev/plugins/list/plugin-image-compress).
96
96
 
97
97
  ## Split Chunk
98
98
 
99
99
  A great chunk splitting strategy is very important to improve the loading performance of the application. It can make full use of the browser's caching mechanism to reduce the number of requests and improve the loading speed of the application.
100
100
 
101
- A variety of [chunk splitting strategies](https://modernjs.dev/builder/en/guide/optimization/split-chunk) are built into Builder, which can meet the needs of most applications. You can also customize the chunk splitting config according to your own business scenarios.
101
+ A variety of [chunk splitting strategies](https://rsbuild.dev/guide/optimization/split-chunk) are built into Modern.js, which can meet the needs of most applications. You can also customize the chunk splitting config according to your own business scenarios.
102
102
 
103
103
  For example, split the `axios` library under node_modules into `axios.js`:
104
104
 
@@ -55,8 +55,6 @@ import RspackPrecautions from '@modern-js/builder-doc/docs/en/shared/rspackPreca
55
55
 
56
56
  ## Migrating configuration
57
57
 
58
- After enabling Rspack building capability, further configuration migration is needed by referring to the [Configuration Differences](https://modernjs.dev/builder/en/guide/advanced/rspack-start.html#migrating-from-webpack-to-rspack).
59
-
60
58
  In Modern.js, the [tools.webpack](/configure/app/tools/webpack) and [tools.webpackChain](/configure/app/tools/webpack-chain) configurations only take effect in webpack mode, after turning on the Rspack build, you can modify it to [tools.rspack](/configure/app/tools/rspack) and [tools.bundlerChain](/configure/app/tools/bundler-chain).
61
59
 
62
60
  ```diff
@@ -12,13 +12,13 @@ Modern.js has built-in popular community CSS preprocessors, including Less and S
12
12
 
13
13
  By default, you don't need to configure Less and Sass. If you have custom loader configuration requirements, you can set them up by configuring [tools.less](/configure/app/tools/less) and [tools.sass](/configure/app/tools/sass).
14
14
 
15
- You can also use Stylus in Modern.js by installing the Stylus plugin provided by Modern.js Builder. For usage, please refer to [Stylus Plugin](https://modernjs.dev/builder/plugins/plugin-stylus.html).
15
+ You can also use Stylus in Modern.js by installing the Stylus plugin provided by Rsbuild. For usage, please refer to [Stylus Plugin](https://rsbuild.dev/plugins/list/plugin-stylus).
16
16
 
17
17
  ## Using PostCSS
18
18
 
19
19
  Modern.js has built-in [PostCSS](https://postcss.org/) to transform CSS code.
20
20
 
21
- Please refer to [Modern.js Builder - Using PostCSS](https://modernjs.dev/builder/en/guide/basic/css-usage.html#using-postcss) for detailed usage.
21
+ Please refer to [Rsbuild - Using PostCSS](https://rsbuild.dev/guide/basic/css-usage#using-postcss) for detailed usage.
22
22
 
23
23
  ## Using CSS Modules
24
24
 
@@ -4,9 +4,9 @@ sidebar_position: 2
4
4
 
5
5
  # Build Engine
6
6
 
7
- **Modern.js uses [Modern.js Builder](https://modernjs.dev/builder/en) to build your Web App.**
7
+ Modern.js Builder refers to the build layer of Modern.js. Its goal is to provide Modern.js users with out-of-the-box build capabilities and support seamless switching between webpack and Rspack.
8
8
 
9
- Modern.js Builder is one of the core components of the Modern.js system. It is a build tool for web development scenarios that can be used independently of Modern.js. Modern.js Builder supports multiple bundlers such as webpack and Rspack, and by default uses the most mature webpack for bundling.
9
+ Modern.js Builder is based on [Rsbuild](https://rsbuild.dev/). Rsbuild is a build tool for web development scenarios that can be used independently of Modern.js.
10
10
 
11
11
  ## Build Architecture
12
12
 
@@ -20,28 +20,14 @@ From a building perspective, Modern.js is divided into three layers, from top to
20
20
 
21
21
  ## Builder Documentation
22
22
 
23
- Since Modern.js Builder is a module that can be used independently, we have provided separate documentation for it, which can be found at [modernjs.dev/builder](https://modernjs.dev/builder/en).
23
+ The documentation address of Rsbuild is: https://rsbuild.dev/
24
24
 
25
- In this documentation, you can learn about the detailed introduction of Modern.js Builder, and you can also find complete usage guides for various building capabilities. If you have any building needs or problems, it is recommended that you read the Modern.js Builder documentation first to solve them.
25
+ In this documentation, you can learn about the detailed introduction of Rsbuild, and you can also find complete usage guides for various building capabilities.
26
26
 
27
- ## Builder Configuration
28
-
29
- Modern.js's configuration inherits from Modern.js Builder, so you can use all the build configurations provided by Modern.js Builder in Modern.js.
30
-
31
- Taking the `html.title` config option of Modern.js Builder as an example, you can directly use this option in the `modern.config.ts` file, and it will be automatically passed to Modern.js Builder.
32
-
33
- ```ts title="modern.config.js"
34
- export default defineConfig({
35
- html: {
36
- title: 'example',
37
- },
38
- });
39
- ```
40
-
41
- For detailed information about build configuration, please refer to [「Modern.js Builder - Builder Config」](https://modernjs.dev/builder/en/guide/basic/builder-config.html).
27
+ If you want to understand the use of build configurations, it is recommended that you read the Modern.js documentation first, because the build configurations and defaults in Modern.js are not exactly the same as Rsbuild.
42
28
 
43
29
  ## Builder Capabilities
44
30
 
45
- Modern.js Builder provides rich build capabilities, including JavaScript compilation, CSS compilation, static assets processing, code hot update, code compression, TS type checking, and dozens of other capabilities.
31
+ Rsbuild provides rich build capabilities, including JavaScript compilation, CSS compilation, static assets processing, code hot update, code compression, TS type checking, and dozens of other capabilities.
46
32
 
47
- We recommend that you read [「Modern.js Builder - All Features」](https://modernjs.dev/builder/en/guide/features.html) to learn about all the features provided by Modern.js Builder.
33
+ We recommend that you read [「Rsbuild - All Features」](https://rsbuild.dev/guide/start/features) to learn about all the features provided by Rsbuild.
@@ -89,7 +89,7 @@ Modern.js supports enabling ["Tailwind CSS"](/en/guides/basic-features/css.html#
89
89
  Modern.js supports three CSS preprocessors: [Sass](https://sass-lang.com/), [Less](https://lesscss.org/), and [Stylus](https://stylus-lang.com/):
90
90
 
91
91
  - Sass and Less are supported by default and ready to use.
92
- - Stylus is optional and can be used by referring to the ["Stylus Plugin"](https://modernjs.dev/builder/en/plugins/plugin-stylus.html).
92
+ - Stylus is optional and can be used by referring to the ["Stylus Plugin"](https://rsbuild.dev/plugins/list/plugin-stylus).
93
93
 
94
94
  ---
95
95
 
@@ -195,7 +195,7 @@ Options:
195
195
 
196
196
  ## modern inspect
197
197
 
198
- `modern inspect` 命令用于查看项目的 [Modern.js Builder 配置](https://modernjs.dev/builder/guide/basic/builder-config.html) 以及 webpack 配置。
198
+ `modern inspect` 命令用于查看项目的 [Rsbuild 配置](https://rsbuild.dev/zh/config/index) 以及 webpack 或 Rspack 配置。
199
199
 
200
200
  ```bash
201
201
  Usage: modern inspect [options]
@@ -210,16 +210,16 @@ Options:
210
210
 
211
211
  在项目根目录下执行命令 `npx modern inspect` 后,会在项目的 `dist` 目录生成以下文件:
212
212
 
213
- - `builder.config.js`: 表示在构建时使用的 Modern.js Builder 配置。
214
- - `webpack.config.web.js`: 表示在构建时使用的 webpack 配置。
213
+ - `rsbuild.config.mjs`: 表示在构建时使用的 Rsbuild 配置。
214
+ - `webpack.config.web.mjs`: 表示在构建时使用的 webpack 配置。
215
215
 
216
216
  ```bash
217
217
  ➜ npx modern inspect
218
218
 
219
219
  Inspect config succeed, open following files to view the content:
220
220
 
221
- - Builder Config: /root/my-project/dist/builder.config.js
222
- - Webpack Config (web): /root/my-project/dist/webpack.config.web.js
221
+ - Rsbuild Config: /root/my-project/dist/rsbuild.config.mjs
222
+ - Webpack Config (web): /root/my-project/dist/webpack.config.web.mjs
223
223
  ```
224
224
 
225
225
  ### 指定环境
@@ -240,16 +240,16 @@ modern inspect --verbose
240
240
 
241
241
  ### SSR 构建配置
242
242
 
243
- 如果项目开启了 SSR 能力,则在 `dist` 目录会另外生成一份 `webpack.config.node.js` 文件,对应 SSR 构建时的 webpack 配置。
243
+ 如果项目开启了 SSR 能力,则在 `dist` 目录会另外生成一份 `webpack.config.node.mjs` 文件,对应 SSR 构建时的 webpack 配置。
244
244
 
245
245
  ```bash
246
246
  ➜ npx modern inspect
247
247
 
248
248
  Inspect config succeed, open following files to view the content:
249
249
 
250
- - Builder Config: /root/my-project/dist/builder.config.js
251
- - Webpack Config (web): /root/my-project/dist/webpack.config.web.js
252
- - Webpack Config (node): /root/my-project/dist/webpack.config.node.js
250
+ - Rsbuild Config: /root/my-project/dist/rsbuild.config.mjs
251
+ - Webpack Config (web): /root/my-project/dist/webpack.config.web.mjs
252
+ - Webpack Config (node): /root/my-project/dist/webpack.config.node.mjs
253
253
  ```
254
254
 
255
255
  ## modern lint
@@ -4,18 +4,18 @@ sidebar_position: 21
4
4
 
5
5
  # builderPlugins 构建插件
6
6
 
7
- - **类型:** `BuilderPlugin[]`
7
+ - **类型:** `RsbuildPlugin[]`
8
8
  - **默认值:** `[]`
9
9
 
10
- 用于配置 Modern.js Builder 构建插件。
10
+ 用于配置 Rsbuild 构建插件。
11
11
 
12
- Modern.js Builder 是 Modern.js 底层的构建工具,请阅读 [构建能力](/guides/concept/builder) 了解相关背景。
12
+ Rsbuild 是 Modern.js 底层的构建工具,请阅读 [构建能力](/guides/concept/builder) 了解相关背景。
13
13
 
14
- 如果你想了解 Builder 插件的编写方式,可以参考 [Modern.js Builder - 插件系统](https://modernjs.dev/builder/plugins/introduction.html)。
14
+ 如果你想了解 Rsbuild 插件的编写方式,可以参考 [Rsbuild - 插件系统](https://rsbuild.dev/zh/plugins/dev/index)。
15
15
 
16
16
  ## 注意事项
17
17
 
18
- 该选项**用于配置 Modern.js Builder 构建插件**,如果你需要配置其他类型的插件,请选择对应的配置方式:
18
+ 该选项**用于配置 Rsbuild 构建插件**,如果你需要配置其他类型的插件,请选择对应的配置方式:
19
19
 
20
20
  - 配置 Modern.js 框架插件,请使用 [plugins](/configure/app/plugins) 配置项。
21
21
  - 配置 Rspack 或 webpack 插件,请使用 [tools.bundlerChain](/configure/app/tools/bundler-chain) 配置项。
@@ -23,23 +23,23 @@ Modern.js Builder 是 Modern.js 底层的构建工具,请阅读 [构建能力]
23
23
 
24
24
  ## 何时使用
25
25
 
26
- 大部分场景下,我们推荐你使用 Modern.js 框架插件,框架插件可以通过 [plugins](/configure/app/plugins) 字段进行注册。因为框架插件提供的 API 更丰富、能力更强,而 Builder 插件提供的 API 只能用于构建场景。
26
+ 大部分场景下,我们推荐你使用 Modern.js 框架插件,框架插件可以通过 [plugins](/configure/app/plugins) 字段进行注册。因为框架插件提供的 API 更丰富、能力更强,而 Rsbuild 插件提供的 API 只能用于构建场景。
27
27
 
28
- 当你需要引用一些现有的 Builder 插件(并且在 Modern.js 中没有相关能力),或是在不同的框架之间复用 Builder 插件时,你可以使用 `builderPlugins` 字段进行注册。
28
+ 当你需要引用一些现有的 Rsbuild 插件(并且在 Modern.js 中没有相关能力),或是在不同的框架之间复用 Rsbuild 插件时,你可以使用 `builderPlugins` 字段进行注册。
29
29
 
30
30
  ## 示例
31
31
 
32
- 下面是 Builder 插件的使用示例。
32
+ 下面是 Rsbuild 插件的使用示例。
33
33
 
34
34
  ### 使用 npm 上的插件
35
35
 
36
36
  使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。
37
37
 
38
38
  ```ts title="modern.config.ts"
39
- import { myBuilderPlugin } from 'my-builder-plugin';
39
+ import { myRsbuildPlugin } from 'my-rsbuild-plugin';
40
40
 
41
41
  export default defineConfig({
42
- builderPlugins: [myBuilderPlugin()],
42
+ builderPlugins: [myRsbuildPlugin()],
43
43
  });
44
44
  ```
45
45
 
@@ -48,10 +48,10 @@ export default defineConfig({
48
48
  使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。
49
49
 
50
50
  ```ts title="modern.config.ts"
51
- import { myBuilderPlugin } from './plugin/myBuilderPlugin';
51
+ import { myRsbuildPlugin } from './plugin/myRsbuildPlugin';
52
52
 
53
53
  export default defineConfig({
54
- builderPlugins: [myBuilderPlugin()],
54
+ builderPlugins: [myRsbuildPlugin()],
55
55
  });
56
56
  ```
57
57
 
@@ -60,11 +60,11 @@ export default defineConfig({
60
60
  如果插件提供了一些自定义的配置项,可以通过插件函数的参数传入配置。
61
61
 
62
62
  ```ts title="modern.config.ts"
63
- import { myBuilderPlugin } from 'my-builder-plugin';
63
+ import { myRsbuildPlugin } from 'my-rsbuild-plugin';
64
64
 
65
65
  export default defineConfig({
66
66
  builderPlugins: [
67
- myBuilderPlugin({
67
+ myRsbuildPlugin({
68
68
  foo: 1,
69
69
  bar: 2,
70
70
  }),
@@ -19,4 +19,4 @@ export default defineConfig({
19
19
  });
20
20
  ```
21
21
 
22
- 该配置项基于 Modern.js Builder 的 Node Polyfill 插件实现,你可以阅读 [Modern.js Builder - Node Polyfill 插件](https://modernjs.dev/builder/plugins/plugin-node-polyfill.html) 文档来了解详细信息。
22
+ 该配置项基于 Rsbuild 的 Node Polyfill 插件实现,你可以阅读 [Rsbuild - Node Polyfill 插件](https://rsbuild.dev/zh/plugins/list/plugin-node-polyfill) 文档来了解详细信息。
@@ -19,7 +19,7 @@ ios_saf >= 10
19
19
  ```
20
20
 
21
21
  :::tip
22
- 请查看 [Modern.js Builder - 设置浏览器范围](https://modernjs.dev/builder/guide/advanced/browserslist) 来了解更多内容。
22
+ 请查看 [Rsbuild - 设置浏览器范围](https://rsbuild.dev/zh/guide/advanced/browserslist) 来了解更多内容。
23
23
  :::
24
24
 
25
25
  ## Polyfill
@@ -44,9 +44,9 @@ BUNDLE_ANALYZE=true pnpm build
44
44
 
45
45
  ## 提升 Browserslist 范围
46
46
 
47
- Builder 会根据项目的 Browserslist 配置范围进行代码编译,并注入相应的 Polyfill。如果项目不需要兼容旧版浏览器,可以根据实际情况来提升 Browserslist 范围,从而减少在语法和 Polyfill 上的编译开销。
47
+ Modern.js 会根据项目的 Browserslist 配置范围进行代码编译,并注入相应的 Polyfill。如果项目不需要兼容旧版浏览器,可以根据实际情况来提升 Browserslist 范围,从而减少在语法和 Polyfill 上的编译开销。
48
48
 
49
- Builder 默认的 Browserslist 配置为:
49
+ Modern.js 默认的 Browserslist 配置为:
50
50
 
51
51
  ```js
52
52
  ['> 0.01%', 'not dead', 'not op_mini all'];
@@ -59,14 +59,14 @@ Builder 默认的 Browserslist 配置为:
59
59
  ```
60
60
 
61
61
  :::tip
62
- 请阅读 [设置浏览器范围](https://modernjs.dev/builder/guide/advanced/browserslist.html) 章节来了解更多关于 Browserslist 的用法。
62
+ 请阅读 [设置浏览器范围](https://rsbuild.dev/zh/guide/advanced/browserslist) 章节来了解更多关于 Browserslist 的用法。
63
63
  :::
64
64
 
65
65
  ## 按需引入 polyfill
66
66
 
67
67
  在明确第三方依赖不需要额外 polyfill 的情况下,你可以将 [output.polyfill](/configure/app/output/polyfill.html) 设置为 `usage`。
68
68
 
69
- 在 `usage` 模式下,Builder 会分析源代码中使用的语法,按需注入所需的 polyfill 代码,从而减少 polyfill 的代码量。
69
+ 在 `usage` 模式下,Modern.js 会分析源代码中使用的语法,按需注入所需的 polyfill 代码,从而减少 polyfill 的代码量。
70
70
 
71
71
  ```js
72
72
  export default {
@@ -85,20 +85,20 @@ export default {
85
85
  在一般的前端项目中,图片资源的体积往往是项目产物体积的大头,因此如果能尽可能精简图片的体积,那么将会对项目的打包产物体积起到明显的优化效果。你可以在 Modern.js 中注册插件来启用图片压缩功能:
86
86
 
87
87
  ```js title="modern.config.ts"
88
- import { builderPluginImageCompress } from '@modern-js/builder-plugin-image-compress';
88
+ import { pluginImageCompress } from '@rsbuild/plugin-image-compress';
89
89
 
90
90
  export default {
91
- builderPlugins: [builderPluginImageCompress()],
91
+ builderPlugins: [pluginImageCompress()],
92
92
  };
93
93
  ```
94
94
 
95
- 详见 [Image Compress 插件](https://modernjs.dev/builder/plugins/plugin-image-compress.html)。
95
+ 详见 [Image Compress 插件](https://rsbuild.dev/zh/plugins/list/plugin-image-compress)。
96
96
 
97
97
  ## 代码拆包
98
98
 
99
99
  良好的拆包策略对于提升应用的加载性能是十分重要的,可以充分利用浏览器的缓存机制,减少请求数量,加快页面加载速度。
100
100
 
101
- 在 Modern.js 中内置了[多种拆包策略](https://modernjs.dev/builder/guide/optimization/split-chunk),可以满足大部分应用的需求,你也可以根据自己的业务场景,自定义拆包配置。
101
+ 在 Modern.js 中内置了[多种拆包策略](https://rsbuild.dev/zh/guide/optimization/split-chunk),可以满足大部分应用的需求,你也可以根据自己的业务场景,自定义拆包配置。
102
102
 
103
103
  比如将 node_modules 下的 `axios` 库拆分到 `axios.js` 中:
104
104
 
@@ -12,13 +12,13 @@ Modern.js 内置了社区流行的 CSS 预处理器,包括 Less 和 Sass。
12
12
 
13
13
  默认情况下,你不需要对 Less 和 Sass 进行任何配置。如果你有自定义 loader 配置的需求,可以通过配置 [tools.less](/configure/app/tools/less)、[tools.sass](/configure/app/tools/sass) 来进行设置。
14
14
 
15
- 你也可以在 Modern.js 中使用 Stylus,只需要安装 Modern.js Builder 提供的 Stylus 插件即可,使用方式请参考 [Stylus 插件](https://modernjs.dev/builder/plugins/plugin-stylus.html)。
15
+ 你也可以在 Modern.js 中使用 Stylus,只需要安装 Rsbuild 提供的 Stylus 插件即可,使用方式请参考 [Stylus 插件](https://rsbuild.dev/zh/plugins/list/plugin-stylus)。
16
16
 
17
17
  ## 使用 PostCSS
18
18
 
19
19
  Modern.js 内置了 [PostCSS](https://postcss.org/) 来转换 CSS 代码。
20
20
 
21
- 请阅读 [Modern.js Builder - 使用 PostCSS](https://modernjs.dev/builder/guide/basic/css-usage.html#%E4%BD%BF%E7%94%A8-postcss) 了解更多用法。
21
+ 请阅读 [Rsbuild - 使用 PostCSS](https://rsbuild.dev/zh/guide/basic/css-usage#%E4%BD%BF%E7%94%A8-postcss) 了解更多用法。
22
22
 
23
23
  ## 使用 CSS Modules
24
24
 
@@ -4,9 +4,9 @@ sidebar_position: 2
4
4
 
5
5
  # 构建工具
6
6
 
7
- **Modern.js 的构建能力由 [Modern.js Builder](https://modernjs.dev/builder) 提供。**
7
+ Modern.js Builder 指的是 Modern.js 的构建层,它的目标是为 Modern.js 用户提供开箱即用的构建能力,并支持在 webpack 和 Rspack 间无缝切换。
8
8
 
9
- Modern.js Builder Modern.js 体系的核心组件之一,它是一个基于 Rspack 的 Web 构建工具,可以脱离 Modern.js 被独立使用。Modern.js Builder 同时支持 webpack 和 Rspack 等多种打包工具,默认情况下使用最成熟的 webpack 进行打包。
9
+ Modern.js Builder 基于 [Rsbuild](https://rsbuild.dev/) 封装。Rsbuild 是一个基于 Rspack 的 Web 构建工具,可以脱离 Modern.js 被独立使用。
10
10
 
11
11
  ## 构建架构
12
12
 
@@ -20,28 +20,14 @@ Modern.js Builder 是 Modern.js 体系的核心组件之一,它是一个基于
20
20
 
21
21
  ## 构建文档
22
22
 
23
- 由于 Modern.js Builder 是一个可独立使用的模块,我们为它提供了单独的文档,文档地址为:[modernjs.dev/builder](https://modernjs.dev/builder)。
23
+ Rsbuild 的文档地址为:https://rsbuild.dev/
24
24
 
25
- 在该文档中,你可以了解到 Modern.js Builder 的详细介绍,同时也可以找到各个构建能力的完整使用指南。当你遇到构建方面的需求或问题时,建议你优先阅读 Modern.js Builder 文档来解决。
25
+ 在该文档中,你可以了解到 Rsbuild 的详细介绍,同时也可以找到各个构建能力的完整使用指南。
26
26
 
27
- ## 构建配置
28
-
29
- Modern.js 的配置继承自 Modern.js Builder,因此你可以在 Modern.js 中使用 Modern.js Builder 提供的所有构建配置。
30
-
31
- 以 Modern.js Builder 的 `html.title` 配置项为例,你可以直接在 `modern.config.ts` 文件中使用该配置项,它会被自动传递给 Modern.js Builder。
32
-
33
- ```ts title="modern.config.js"
34
- export default defineConfig({
35
- html: {
36
- title: 'example',
37
- },
38
- });
39
- ```
40
-
41
- 关于构建配置的详细说明,请参考 [「Modern.js Builder - Builder 配置」](https://modernjs.dev/builder/guide/basic/builder-config.html)。
27
+ 如果你想要了解某些构建配置的使用,建议你优先阅读 Modern.js 文档,因为 Modern.js 中的构建配置和默认值与 Rsbuild 并不完全相同。
42
28
 
43
29
  ## 构建能力
44
30
 
45
- Modern.js Builder 提供了丰富的构建能力,包括 JavaScript 编译、CSS 编译、静态资源处理、代码热更新、代码压缩、TS 类型检查等几十种能力。
31
+ Rsbuild 提供了丰富的构建能力,包括 JavaScript 编译、CSS 编译、静态资源处理、代码热更新、代码压缩、TS 类型检查等几十种能力。
46
32
 
47
- 我们推荐你阅读 [「Modern.js Builder - 功能导航」](https://modernjs.dev/builder/guide/features.html) 来了解 Modern.js Builder 提供的所有构建能力。
33
+ 我们推荐你阅读 [「Rsbuild - 功能导航」](https://rsbuild.dev/zh/guide/start/features) 来了解 Rsbuild 提供的所有构建能力。
@@ -89,7 +89,7 @@ Modern.js 支持[「启用 Tailwind CSS」](/guides/basic-features/css.html#使
89
89
  Modern.js 支持 [Sass](https://sass-lang.com/)、[Less](https://lesscss.org/) 和 [Stylus](https://stylus-lang.com/) 三种 CSS 预处理器:
90
90
 
91
91
  - 默认支持 Sass 和 Less,开箱即用。
92
- - 可选支持 Stylus,请参考[「Stylus 插件」](https://modernjs.dev/builder/plugins/plugin-stylus.html) 来使用。
92
+ - 可选支持 Stylus,请参考[「Stylus 插件」](https://rsbuild.dev/zh/plugins/list/plugin-stylus) 来使用。
93
93
 
94
94
  ---
95
95
 
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20240123170645",
18
+ "version": "0.0.0-nightly-20240124170638",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "dependencies": {
25
- "@modern-js/sandpack-react": "0.0.0-nightly-20240123170645"
25
+ "@modern-js/sandpack-react": "0.0.0-nightly-20240124170638"
26
26
  },
27
27
  "peerDependencies": {
28
- "@modern-js/builder-doc": "0.0.0-nightly-20240123170645"
28
+ "@modern-js/builder-doc": "0.0.0-nightly-20240124170638"
29
29
  },
30
30
  "devDependencies": {
31
31
  "classnames": "^2",
@@ -39,8 +39,8 @@
39
39
  "@rspress/shared": "1.10.1",
40
40
  "@types/node": "^16",
41
41
  "@types/fs-extra": "9.0.13",
42
- "@modern-js/builder-doc": "0.0.0-nightly-20240123170645",
43
- "@modern-js/doc-plugin-auto-sidebar": "0.0.0-nightly-20240123170645"
42
+ "@modern-js/doc-plugin-auto-sidebar": "0.0.0-nightly-20240124170638",
43
+ "@modern-js/builder-doc": "0.0.0-nightly-20240124170638"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "rspress dev",