@modern-js/main-doc 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/en/configure/app/server/rsc.mdx +1 -1
- package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +1 -1
- package/docs/en/guides/basic-features/deploy.mdx +6 -6
- package/docs/en/guides/basic-features/render/rsc.mdx +2 -2
- package/docs/en/guides/get-started/tech-stack.mdx +1 -1
- package/docs/en/guides/topic-detail/module-federation/application.mdx +4 -4
- package/docs/en/guides/topic-detail/module-federation/usage.mdx +1 -1
- package/docs/zh/configure/app/server/rsc.mdx +1 -1
- package/docs/zh/guides/advanced-features/page-performance/react-compiler.mdx +1 -1
- package/docs/zh/guides/basic-features/deploy.mdx +6 -6
- package/docs/zh/guides/basic-features/render/rsc.mdx +2 -2
- package/docs/zh/guides/topic-detail/module-federation/application.mdx +4 -4
- package/docs/zh/guides/topic-detail/module-federation/usage.mdx +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ export default defineConfig({
|
|
|
22
22
|
:::tip Prerequisites
|
|
23
23
|
Before enabling RSC, ensure:
|
|
24
24
|
1. React and React DOM are upgraded to version 19 (recommended 19.2.4 or above)
|
|
25
|
-
2. Install the `react-server-dom-rspack@0.0.
|
|
25
|
+
2. Install the `react-server-dom-rspack@0.0.2` dependency
|
|
26
26
|
|
|
27
27
|
:::
|
|
28
28
|
|
|
@@ -51,4 +51,4 @@ export default defineConfig({
|
|
|
51
51
|
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> For detailed code, you can refer to the [Modern.js & React Compiler example project](https://github.com/web-infra-dev/modern
|
|
54
|
+
> For detailed code, you can refer to the [Modern.js & React Compiler example project](https://github.com/web-infra-dev/modern.js/tree/main/examples/react-compiler)
|
|
@@ -112,7 +112,7 @@ Add the following content to `netlify.toml`:
|
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
:::info
|
|
115
|
-
You can refer to the [deployment project example](https://github.com/web-infra-dev/modern
|
|
115
|
+
You can refer to the [deployment project example](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr).
|
|
116
116
|
|
|
117
117
|
:::
|
|
118
118
|
|
|
@@ -137,7 +137,7 @@ Full-stack projects refer to projects that use Custom Web Server, SSR or BFF. Th
|
|
|
137
137
|
:::info
|
|
138
138
|
|
|
139
139
|
1. Currently, Modern.js does not support deployment on Netlify Edge Functions. We will support it in future versions.
|
|
140
|
-
2. You can refer to the [deployment project example](https://github.com/web-infra-dev/modern
|
|
140
|
+
2. You can refer to the [deployment project example](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-ssr).
|
|
141
141
|
|
|
142
142
|
:::
|
|
143
143
|
|
|
@@ -223,7 +223,7 @@ Commit your project to git, select Framework Preset as `Other` on the Vercel pla
|
|
|
223
223
|
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-framework-preset.png" />
|
|
224
224
|
|
|
225
225
|
:::info
|
|
226
|
-
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern
|
|
226
|
+
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr).
|
|
227
227
|
|
|
228
228
|
:::
|
|
229
229
|
|
|
@@ -237,7 +237,7 @@ In addition to configuring `vercel.json` in the same way as a [pure front-end pr
|
|
|
237
237
|
2. The Node.js version for function execution is determined by the project configuration on the Vercel platform.
|
|
238
238
|
|
|
239
239
|
:::info
|
|
240
|
-
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern
|
|
240
|
+
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-ssr).
|
|
241
241
|
|
|
242
242
|
:::
|
|
243
243
|
|
|
@@ -335,10 +335,10 @@ For branch deployment, follow these steps:
|
|
|
335
335
|
:::info
|
|
336
336
|
|
|
337
337
|
1. Running `MODERNJS_DEPLOY=ghPages modern deploy` will build the production output for GitHub in the .output directory.
|
|
338
|
-
2. You can refer to the [project](https://github.com/web-infra-dev/modern
|
|
338
|
+
2. You can refer to the [project](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr)
|
|
339
339
|
:::
|
|
340
340
|
|
|
341
|
-
For GitHub Actions deployment, select Settings > Pages > Source > GitHub Actions, and add a workflow file to the project. You can refer to the [example](https://github.com/web-infra-dev/modern
|
|
341
|
+
For GitHub Actions deployment, select Settings > Pages > Source > GitHub Actions, and add a workflow file to the project. You can refer to the [example](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr).
|
|
342
342
|
|
|
343
343
|
## Using Self-Built Node.js Server
|
|
344
344
|
|
|
@@ -23,10 +23,10 @@ Before starting, we recommend reading React's official [Server Components docume
|
|
|
23
23
|
|
|
24
24
|
1. **Ensure React and React DOM are upgraded to version 19** (recommended version 19.2.4 or above)
|
|
25
25
|
|
|
26
|
-
2. **Install the `react-server-dom-rspack@0.0.
|
|
26
|
+
2. **Install the `react-server-dom-rspack@0.0.2` dependency**
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install react-server-dom-rspack@0.0.
|
|
29
|
+
npm install react-server-dom-rspack@0.0.2
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
:::warning Notes
|
|
@@ -10,7 +10,7 @@ In this document, you can learn about the main technology stack involved in the
|
|
|
10
10
|
|
|
11
11
|
## UI Library
|
|
12
12
|
|
|
13
|
-
Modern.js uses [React
|
|
13
|
+
Modern.js uses [React 19](https://react.dev/) to build user interfaces and is also compatible with React 18.
|
|
14
14
|
|
|
15
15
|
Rsbuild supports building Vue applications. If you need to use Vue, you can refer to ["Rsbuild - Vue"](https://v2.rsbuild.rs/guide/framework/vue).
|
|
16
16
|
|
|
@@ -62,7 +62,7 @@ export default createModuleFederationConfig({
|
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
:::info
|
|
65
|
-
[`createBridgeComponent`](https://module-federation.io/
|
|
65
|
+
[`createBridgeComponent`](https://module-federation.io/guide/bridge/overview#core-apis) is used to export application-level modules. Modern.js related APIs can be found at [createRoot](/apis/app/runtime/core/create-root) and [render](/apis/app/runtime/core/render).
|
|
66
66
|
:::
|
|
67
67
|
|
|
68
68
|
## Using Modules in Consumer
|
|
@@ -98,7 +98,7 @@ export default RemoteApp;
|
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
:::info
|
|
101
|
-
[`createRemoteAppComponent`](https://module-federation.io/
|
|
101
|
+
[`createRemoteAppComponent`](https://module-federation.io/guide/bridge/overview#core-apis) is used to load application-level modules.
|
|
102
102
|
:::
|
|
103
103
|
|
|
104
104
|
## Start the Application
|
|
@@ -109,8 +109,8 @@ After startup, when the consumer application accesses the `/remote` route, it wi
|
|
|
109
109
|
|
|
110
110
|
You can create new route files in the producer application and add route navigation in the code. These functionalities will also work as expected.
|
|
111
111
|
|
|
112
|
-
You can refer to the example here: [Modern.js & Module Federation Application-Level Modules](https://github.com/web-infra-dev/modern
|
|
112
|
+
You can refer to the example here: [Modern.js & Module Federation Application-Level Modules](https://github.com/web-infra-dev/modern.js/tree/main/examples/module-federation/app-export).
|
|
113
113
|
|
|
114
114
|
## Related Documentation
|
|
115
115
|
|
|
116
|
-
- [Module Federation Bridge](https://module-federation.io/
|
|
116
|
+
- [Module Federation Bridge](https://module-federation.io/guide/bridge/overview)
|
|
@@ -195,7 +195,7 @@ Now, in the producer, run `modern build && MODERN_MF_AUTO_CORS=true modern serv
|
|
|
195
195
|
When using the `modern serve` command, you need to set the `MODERN_MF_AUTO_CORS=true` environment variable when starting the producer project to automatically handle CORS issues and ensure that consumers can properly access the producer's remote module resources.
|
|
196
196
|
:::
|
|
197
197
|
|
|
198
|
-
You can refer to this example: [Modern.js & Module Federation Basic Example](https://github.com/web-infra-dev/modern
|
|
198
|
+
You can refer to this example: [Modern.js & Module Federation Basic Example](https://github.com/web-infra-dev/modern.js/tree/main/examples/module-federation/base).
|
|
199
199
|
|
|
200
200
|
## Related Documentation
|
|
201
201
|
|
|
@@ -51,4 +51,4 @@ export default defineConfig({
|
|
|
51
51
|
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> 详细代码可以参考:[Modern.js & React Compiler 示例项目](https://github.com/web-infra-dev/modern
|
|
54
|
+
> 详细代码可以参考:[Modern.js & React Compiler 示例项目](https://github.com/web-infra-dev/modern.js/tree/main/examples/react-compiler)
|
|
@@ -109,7 +109,7 @@ Netlify 是一个流行的 Web 开发平台,专为构建、发布和维护现
|
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
:::info
|
|
112
|
-
你可参考部署[项目示例](https://github.com/web-infra-dev/modern
|
|
112
|
+
你可参考部署[项目示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr)。
|
|
113
113
|
:::
|
|
114
114
|
|
|
115
115
|
在 Netlify 平台上添加项目,部署即可。
|
|
@@ -133,7 +133,7 @@ Netlify 是一个流行的 Web 开发平台,专为构建、发布和维护现
|
|
|
133
133
|
:::info
|
|
134
134
|
|
|
135
135
|
1. 目前 Modern.js 还不支持在 Netlify Edge Functions 进行部署,我们将在后续的版本中支持。
|
|
136
|
-
2. 你可参考部署[项目示例](https://github.com/web-infra-dev/modern
|
|
136
|
+
2. 你可参考部署[项目示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-ssr)。
|
|
137
137
|
|
|
138
138
|
:::
|
|
139
139
|
|
|
@@ -217,7 +217,7 @@ Vercel 是一个面向现代 Web 应用的部署平台,它提供了丰富的
|
|
|
217
217
|
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-framework-preset.png" />
|
|
218
218
|
|
|
219
219
|
:::info
|
|
220
|
-
你可参考部署[项目示例](https://github.com/web-infra-dev/modern
|
|
220
|
+
你可参考部署[项目示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr)。
|
|
221
221
|
:::
|
|
222
222
|
|
|
223
223
|
### 全栈项目
|
|
@@ -230,7 +230,7 @@ Vercel 是一个面向现代 Web 应用的部署平台,它提供了丰富的
|
|
|
230
230
|
2. 函数运行的 node.js 版本由项目在 Vercel 平台配置决定。
|
|
231
231
|
|
|
232
232
|
:::info
|
|
233
|
-
你可参考部署[项目示例](https://github.com/web-infra-dev/modern
|
|
233
|
+
你可参考部署[项目示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-ssr)。
|
|
234
234
|
|
|
235
235
|
:::
|
|
236
236
|
|
|
@@ -317,11 +317,11 @@ Github Pages 支持两种部署方式,通过分支部署或通过 Github Actio
|
|
|
317
317
|
:::info
|
|
318
318
|
|
|
319
319
|
1. 执行 `MODERNJS_DEPLOY=ghPages modern deploy`,Modern.js 会把可用于 github 部署的产物构建到 `.output` 目录。
|
|
320
|
-
2. 可以参考项目[示例](https://github.com/web-infra-dev/modern
|
|
320
|
+
2. 可以参考项目[示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr)。
|
|
321
321
|
|
|
322
322
|
:::
|
|
323
323
|
|
|
324
|
-
如果通过 Github Actions 部署,可以选择 Settings > Pages > Source > GitHub Actions,并在项目中添加 workflow 文件,可参考[示例](https://github.com/web-infra-dev/modern
|
|
324
|
+
如果通过 Github Actions 部署,可以选择 Settings > Pages > Source > GitHub Actions,并在项目中添加 workflow 文件,可参考[示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr)。
|
|
325
325
|
|
|
326
326
|
## 自建 Node.js 服务器
|
|
327
327
|
|
|
@@ -23,10 +23,10 @@ React Server Components (RSC) 是一种新的组件类型,允许在服务端
|
|
|
23
23
|
|
|
24
24
|
1. **确保 React 和 React DOM 升级到 19 版本**(建议 19.2.4 以上版本)
|
|
25
25
|
|
|
26
|
-
2. **安装 `react-server-dom-rspack@0.0.
|
|
26
|
+
2. **安装 `react-server-dom-rspack@0.0.2` 依赖**
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install react-server-dom-rspack@0.0.
|
|
29
|
+
npm install react-server-dom-rspack@0.0.2
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
:::warning 注意事项
|
|
@@ -63,7 +63,7 @@ export default createModuleFederationConfig({
|
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
:::info
|
|
66
|
-
[`createBridgeComponent`](https://module-federation.io/zh/
|
|
66
|
+
[`createBridgeComponent`](https://module-federation.io/zh/guide/bridge/overview.html#%E6%A0%B8%E5%BF%83-api) 用于导出应用级别模块,Modern.js 相关 API 可以查看 [createRoot](/apis/app/runtime/core/create-root)、[render](/apis/app/runtime/core/render)。
|
|
67
67
|
:::
|
|
68
68
|
|
|
69
69
|
## 消费者使用模块
|
|
@@ -99,7 +99,7 @@ export default RemoteApp;
|
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
:::info
|
|
102
|
-
[`createRemoteAppComponent`](https://module-federation.io/zh/
|
|
102
|
+
[`createRemoteAppComponent`](https://module-federation.io/zh/guide/bridge/overview.html#%E6%A0%B8%E5%BF%83-api) 用于加载应用级别模块。
|
|
103
103
|
:::
|
|
104
104
|
|
|
105
105
|
## 启动应用
|
|
@@ -110,8 +110,8 @@ export default RemoteApp;
|
|
|
110
110
|
|
|
111
111
|
你可以在生产者应用中,创建新的路由文件,并在代码中添加路由导航,可以发现这些功能也能够正常运行。
|
|
112
112
|
|
|
113
|
-
上述用例可以参考:[Modern.js & Module Federation 应用级别模块](https://github.com/web-infra-dev/modern
|
|
113
|
+
上述用例可以参考:[Modern.js & Module Federation 应用级别模块](https://github.com/web-infra-dev/modern.js/tree/main/examples/module-federation/app-export)。
|
|
114
114
|
|
|
115
115
|
## 相关文档
|
|
116
116
|
|
|
117
|
-
- [Module Federation Bridge](https://module-federation.io/zh/
|
|
117
|
+
- [Module Federation Bridge](https://module-federation.io/zh/guide/bridge/overview)
|
|
@@ -193,7 +193,7 @@ export default defineConfig({
|
|
|
193
193
|
在使用 `modern serve` 命令时,需要在启动生产者项目时携带 `MODERN_MF_AUTO_CORS=true` 环境变量,以自动处理跨域问题,确保消费者可以正常访问生产者的远程模块资源。
|
|
194
194
|
:::
|
|
195
195
|
|
|
196
|
-
上述用例可以参考:[Modern.js & Module Federation 基础用法示例](https://github.com/web-infra-dev/modern
|
|
196
|
+
上述用例可以参考:[Modern.js & Module Federation 基础用法示例](https://github.com/web-infra-dev/modern.js/tree/main/examples/module-federation/base)。
|
|
197
197
|
|
|
198
198
|
## 相关文档
|
|
199
199
|
|
package/package.json
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"modern",
|
|
17
17
|
"modern.js"
|
|
18
18
|
],
|
|
19
|
-
"version": "3.
|
|
19
|
+
"version": "3.6.0",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"registry": "https://registry.npmjs.org/",
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"mermaid": "^11.15.0",
|
|
26
|
-
"@modern-js/sandpack-react": "3.
|
|
26
|
+
"@modern-js/sandpack-react": "3.6.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"rsbuild-plugin-open-graph": "1.1.3",
|