@modern-js/main-doc 3.0.3 → 3.0.4
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/basic-features/html.mdx +1 -1
- package/docs/en/guides/basic-features/render/rsc.mdx +2 -2
- package/docs/zh/configure/app/server/rsc.mdx +1 -1
- package/docs/zh/guides/basic-features/html.mdx +1 -1
- package/docs/zh/guides/basic-features/render/rsc.mdx +2 -2
- package/package.json +4 -4
|
@@ -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.1-beta.
|
|
25
|
+
2. Install the `react-server-dom-rspack@0.0.1-beta.1` dependency
|
|
26
26
|
|
|
27
27
|
:::
|
|
28
28
|
|
|
@@ -29,7 +29,7 @@ For example, consider the following directory structure:
|
|
|
29
29
|
If not found, default template will be used.
|
|
30
30
|
|
|
31
31
|
:::tip
|
|
32
|
-
|
|
32
|
+
`Document.tsx` is compiled at build time by the Modern.js Document plugin using a dedicated Rspack child compiler targeting Node.js, and is rendered to a string with `renderToStaticMarkup` as the HTML template content, similar to [Static Site Generation](/guides/basic-features/render/ssg.html). The HTML template module is not part of the page bundler compilation, so React Hooks in the component will not run in the browser runtime, and non-JavaScript assets such as images cannot be resolved or imported.
|
|
33
33
|
:::
|
|
34
34
|
|
|
35
35
|
### HTML Components
|
|
@@ -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.1-beta.
|
|
26
|
+
2. **Install the `react-server-dom-rspack@0.0.1-beta.1` dependency**
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install react-server-dom-rspack@0.0.1-beta.
|
|
29
|
+
npm install react-server-dom-rspack@0.0.1-beta.1
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
:::warning Notes
|
|
@@ -30,7 +30,7 @@ Modern.js 约定,在 `src/` 或入口目录下,可以创建 `Document.tsx`
|
|
|
30
30
|
如果未找到,将会使用 Modern.js 的默认模板。
|
|
31
31
|
|
|
32
32
|
:::tip
|
|
33
|
-
`Document.tsx`
|
|
33
|
+
`Document.tsx` 会在构建时由 Modern.js 的 Document 插件创建 Rspack 子编译器流程,编译为面向 Node.js 的产物,并在编译时以 `renderToStaticMarkup` 渲染为字符串作为 HTML 模板内容,其行为类似[静态站点生成](/guides/basic-features/render/ssg.html)。HTML 模板模块不会经过页面 Bundler 的常规编译打包,因此组件中的 React Hooks 不会在浏览器运行时被执行,也不支持导入 JavaScript 以外的图片等资源模块。
|
|
34
34
|
:::
|
|
35
35
|
|
|
36
36
|
### HTML 组件
|
|
@@ -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.1-beta.
|
|
26
|
+
2. **安装 `react-server-dom-rspack@0.0.1-beta.1` 依赖**
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install react-server-dom-rspack@0.0.1-beta.
|
|
29
|
+
npm install react-server-dom-rspack@0.0.1-beta.1
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
:::warning 注意事项
|
package/package.json
CHANGED
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
"modern",
|
|
17
17
|
"modern.js"
|
|
18
18
|
],
|
|
19
|
-
"version": "3.0.
|
|
19
|
+
"version": "3.0.4",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"registry": "https://registry.npmjs.org/",
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"mermaid": "^11.12.
|
|
26
|
-
"@modern-js/sandpack-react": "3.0.
|
|
25
|
+
"mermaid": "^11.12.3",
|
|
26
|
+
"@modern-js/sandpack-react": "3.0.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@rsbuild/plugin-sass": "1.5.0",
|
|
30
30
|
"@rspress/core": "2.0.2",
|
|
31
31
|
"@rspress/plugin-llms": "2.0.2",
|
|
32
32
|
"@rspress/shared": "2.0.2",
|
|
33
|
-
"@shikijs/transformers": "^3.
|
|
33
|
+
"@shikijs/transformers": "^3.23.0",
|
|
34
34
|
"@types/fs-extra": "9.0.13",
|
|
35
35
|
"@types/node": "^20",
|
|
36
36
|
"classnames": "^2.5.1",
|