@modern-js/main-doc 2.47.0 → 2.48.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@ When the value type is `Object`, the following properties can be configured:
|
|
27
27
|
|
28
28
|
- `mode`: `string = 'string'`, which defaults to using `renderToString` for rendering. Configure `stream` to enable streaming rendering.
|
29
29
|
- `forceCSR`: `boolean = false`, which is off by default for forcing CSR rendering. Configure `true` to force CSR by adding `?csr=true` or adding `x-modern-ssr-fallback` header when accessing the page.
|
30
|
-
- `inlineScript`: `boolean = true`, by default, SSR data is injected into HTML as inline scripts and assigned directly to global variables. Configure `false` to distribute JSON instead of assigning to global variables.
|
30
|
+
- `inlineScript`: `boolean = true`, by default, SSR data is injected into HTML as inline scripts and assigned directly to global variables. Configure `false` to distribute JSON instead of assigning to global variables, this configuration doesn't work in Streaming SSR.
|
31
31
|
- `disablePrerender`: `boolean = fasle`, To ensure compatibility with the old data request method (`useLoader`), by default, Modern.js performs pre-rendering of components.
|
32
32
|
However, if developers want to reduce one rendering when there is no use of the useLoader API in your project, you can set the configuration `disablePrerender=true`.
|
33
33
|
- `unsafeHeaders`: `string[] = []`, For safety reasons, Modern.js does not add excessive content to SSR_DATA. Developers can use this configuration to specify the headers that need to be injected.
|
@@ -7,18 +7,18 @@ sidebar_label: esbuild
|
|
7
7
|
- **Type:** `Object`
|
8
8
|
- **Default:** `undefined`
|
9
9
|
|
10
|
-
|
10
|
+
:::warning
|
11
|
+
**The esbuild feature in the current document is no longer maintained**, we recommend using the Rspack + SWC solution, because Rspack + SWC provide better build performance, richer features, and better compatibility.
|
11
12
|
|
12
|
-
|
13
|
+
Please refer to [「Use Rspack」](/guides/advanced-features/rspack-start.html) for more information.
|
13
14
|
|
14
|
-
|
15
|
+
:::
|
15
16
|
|
16
|
-
|
17
|
-
We recommend using SWC to transform and minify code rather than esbuild, because SWC supports more syntaxes, provides better code compression, and the compiled code has better compatibility.
|
17
|
+
## Introduction
|
18
18
|
|
19
|
-
|
19
|
+
import Esbuild from '@modern-js/builder-doc/docs/en/shared/esbuild.md';
|
20
20
|
|
21
|
-
|
21
|
+
<Esbuild />
|
22
22
|
|
23
23
|
## Configuration
|
24
24
|
|
@@ -27,7 +27,7 @@ export default defineConfig({
|
|
27
27
|
|
28
28
|
- `mode`:`string = 'string'`,默认为使用 `renderToString` 渲染。配置为 `stream` 开启流式渲染。
|
29
29
|
- `forceCSR`:`boolean = false`,默认关闭强制 CSR 渲染。配置为 `true` 后,在页面访问时添加 `?csr=true` 或添加请求头 `x-modern-ssr-fallback` 即可强制 CSR。
|
30
|
-
- `inlineScript`:`boolean = true`,默认情况下,SSR 的数据会以内联脚本的方式注入到 HTML 中,并且直接赋值给全局变量。配置为 `false` 后,会下发 JSON
|
30
|
+
- `inlineScript`:`boolean = true`,默认情况下,SSR 的数据会以内联脚本的方式注入到 HTML 中,并且直接赋值给全局变量。配置为 `false` 后,会下发 JSON,而不是赋值给全局变量,Streaming SSR 下,该配置不会生效。
|
31
31
|
- `disablePrerender`: `boolean = fasle`, 为了兼容旧数据请求方式 - `useLoader`, 默认情况下 Modern.js 会对组件进行一次预渲染即有两次渲染。
|
32
32
|
开发者在保证项目中没有使用 useLoader Api 情况下, 可通过配置 `disablePrerender=true`来减少一次渲染。
|
33
33
|
- `unsafeHeaders`: `string[] = []`, 为了安全考虑,Modern.js 不会往 SSR_DATA 添加过多的内容。开发者可以通过该配置,对需要注入的 headers 进行配置。
|
@@ -7,18 +7,18 @@ sidebar_label: esbuild
|
|
7
7
|
- **类型:** `Object`
|
8
8
|
- **默认值:** `undefined`
|
9
9
|
|
10
|
-
|
10
|
+
:::warning
|
11
|
+
**当前文档中的 esbuild 功能已停止迭代**,我们更推荐使用 Rspack + SWC 的方案,因为 Rspack + SWC 具备更好的构建性能、功能丰富度和产物兼容性。
|
11
12
|
|
12
|
-
|
13
|
+
请参考[「使用 Rspack」](/guides/advanced-features/rspack-start.html)了解更多。
|
13
14
|
|
14
|
-
|
15
|
+
:::
|
15
16
|
|
16
|
-
|
17
|
-
相较于 esbuild,我们更推荐使用 SWC 来编译和压缩代码,因为 SWC 支持更多的语法特性、拥有更好的代码压缩率,并且产物具备更好的兼容性。
|
17
|
+
## 介绍
|
18
18
|
|
19
|
-
|
19
|
+
import Esbuild from '@modern-js/builder-doc/docs/zh/shared/esbuild.md';
|
20
20
|
|
21
|
-
|
21
|
+
<Esbuild />
|
22
22
|
|
23
23
|
## 配置项
|
24
24
|
|
package/package.json
CHANGED
@@ -15,17 +15,17 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.48.0",
|
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": "2.
|
25
|
+
"@modern-js/sandpack-react": "2.48.0"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
|
-
"@modern-js/builder-doc": "^2.
|
28
|
+
"@modern-js/builder-doc": "^2.48.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"classnames": "^2",
|
@@ -35,12 +35,12 @@
|
|
35
35
|
"ts-node": "^10.9.1",
|
36
36
|
"typescript": "^5",
|
37
37
|
"fs-extra": "^10",
|
38
|
-
"rspress": "1.
|
39
|
-
"@rspress/shared": "1.
|
38
|
+
"rspress": "1.12.3",
|
39
|
+
"@rspress/shared": "1.12.3",
|
40
40
|
"@types/node": "^16",
|
41
41
|
"@types/fs-extra": "9.0.13",
|
42
|
-
"@modern-js/builder-doc": "2.
|
43
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.
|
42
|
+
"@modern-js/builder-doc": "2.48.0",
|
43
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.48.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"dev": "rspress dev",
|