@modern-js/main-doc 0.0.0-nightly-20240902170725 → 0.0.0-nightly-20240903170747
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.
|
@@ -8,7 +8,7 @@ import Rspack from '@modern-js/builder-doc/docs/en/shared/rspackTip.mdx';
|
|
|
8
8
|
|
|
9
9
|
<Rspack />
|
|
10
10
|
|
|
11
|
-
**Modern.js provides out-of-the-box Rspack support**, so you can switch between the stable
|
|
11
|
+
**Modern.js provides out-of-the-box Rspack support**, so you can switch between the stable webpack and the faster Rspack.
|
|
12
12
|
|
|
13
13
|
This document will show you how to enable Rspack build mode in Modern.js.
|
|
14
14
|
|
|
@@ -71,7 +71,7 @@ export default {
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
:::tip
|
|
74
|
-
After
|
|
74
|
+
After using Rspack for build, there are currently a few configs that are not supported in Rspack, such as [source.moduleScopes](/configure/app/source/module-scopes).
|
|
75
75
|
|
|
76
76
|
For unsupported configurations, we have marked `Bundler: only support webpack` or `Bundler: only support Rspack` in the document. Please refer to the specific configuration introduction.
|
|
77
77
|
:::
|
|
@@ -141,9 +141,7 @@ If you need to use the nightly/canary version of Rspack, the package name of the
|
|
|
141
141
|
"@rspack/plugin-react-refresh": "npm:@rspack/plugin-react-refresh-canary@nightly"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencyRules": {
|
|
144
|
-
"allowAny": [
|
|
145
|
-
"@rspack/*"
|
|
146
|
-
]
|
|
144
|
+
"allowAny": ["@rspack/*"]
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
}
|
|
@@ -8,7 +8,7 @@ import Rspack from '@modern-js/builder-doc/docs/zh/shared/rspackTip.mdx';
|
|
|
8
8
|
|
|
9
9
|
<Rspack />
|
|
10
10
|
|
|
11
|
-
**Modern.js 提供开箱即用的 Rspack 支持**,你可以在成熟的
|
|
11
|
+
**Modern.js 提供开箱即用的 Rspack 支持**,你可以在成熟的 webpack 和更快的 Rspack 之间进行切换。
|
|
12
12
|
|
|
13
13
|
这篇文档会向你介绍如何在 Modern.js 中开启 Rspack 构建模式。
|
|
14
14
|
|
|
@@ -70,11 +70,10 @@ export default {
|
|
|
70
70
|
};
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
|
|
74
73
|
:::tip
|
|
75
|
-
开启 Rspack
|
|
74
|
+
开启 Rspack 构建后,目前有个别配置暂不支持在 Rspack 中使用,如 [source.moduleScopes](/configure/app/source/module-scopes)。
|
|
76
75
|
|
|
77
|
-
对于不支持的配置,我们在文档中有标注
|
|
76
|
+
对于不支持的配置,我们在文档中有标注 `打包工具:仅支持 webpack` 或 `打包工具:仅支持 rspack`,可参考具体配置介绍。
|
|
78
77
|
:::
|
|
79
78
|
|
|
80
79
|
## 修改转译配置
|
|
@@ -105,7 +104,7 @@ export default defineConfig<'rspack'>({
|
|
|
105
104
|
|
|
106
105
|
通常情况下,Modern.js 内会集成 Rspack 的最新版本,通过 `npx modern upgrade` 即可将当前项目中的 Modern.js 相关依赖以及内置的 Rspack 更新至最新版本。
|
|
107
106
|
|
|
108
|
-
但 Modern.js 对于 Rspack
|
|
107
|
+
但 Modern.js 对于 Rspack 的依赖方式为锁版本方式(非自动升级),由于发版周期不同步等原因,可能会出现 Modern.js 内集成的 Rspack 版本落后于 Rspack 最新版本的情况。
|
|
109
108
|
|
|
110
109
|
当你执行 dev / build 命令时,Modern.js 会在[开启调试模式时](https://rsbuild.dev/zh/guide/debug/debug-mode)自动打印当前使用的 Rspack 版本:
|
|
111
110
|
|
|
@@ -140,9 +139,7 @@ export default defineConfig<'rspack'>({
|
|
|
140
139
|
"@rspack/plugin-react-refresh": "npm:@rspack/plugin-react-refresh@nightly"
|
|
141
140
|
},
|
|
142
141
|
"peerDependencyRules": {
|
|
143
|
-
"allowAny": [
|
|
144
|
-
"@rspack/*"
|
|
145
|
-
]
|
|
142
|
+
"allowAny": ["@rspack/*"]
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
145
|
}
|
|
@@ -265,7 +265,7 @@ export default Page404;
|
|
|
265
265
|
|
|
266
266
|
## 路由句柄配置
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
某些场景下,每个路由会拥有属于自己的数据,应用需要在其他组件中获取匹配到的路由的这些数据。一个常见的例子是在布局中获取到匹配路由的面包屑信息。
|
|
269
269
|
|
|
270
270
|
Modern.js 提供了独立的约定,每个 `Layout`, `$` 或 `Page` 文件都可以定义一个自己的 `config` 文件,如 `page.config.ts`,该文件中我们约定了一个具名导出 `handle`,这个字段中你可以定义任意属性:
|
|
271
271
|
|
package/package.json
CHANGED
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.0.0-nightly-
|
|
18
|
+
"version": "0.0.0-nightly-20240903170747",
|
|
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-
|
|
25
|
+
"@modern-js/sandpack-react": "0.0.0-nightly-20240903170747"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@modern-js/builder-doc": "0.0.0-nightly-
|
|
28
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20240903170747"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rspress/shared": "1.28.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rspress": "1.28.2",
|
|
40
40
|
"ts-node": "^10.9.1",
|
|
41
41
|
"typescript": "^5",
|
|
42
|
-
"@modern-js/builder-doc": "0.0.0-nightly-
|
|
42
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20240903170747"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "rspress dev",
|