@modern-js/main-doc 0.0.0-nightly-20231219170633 → 0.0.0-nightly-20231220170631
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.
@@ -30,6 +30,7 @@ When the value type is `Object`, the following properties can be configured:
|
|
30
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.
|
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
|
+
- `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.
|
33
34
|
|
34
35
|
```ts title="modern.config.ts"
|
35
36
|
export default defineConfig({
|
@@ -38,6 +39,7 @@ export default defineConfig({
|
|
38
39
|
forceCSR: true,
|
39
40
|
mode: 'stream',
|
40
41
|
inlineScript: false,
|
42
|
+
unsafeHeaders: ['User-Agent'],
|
41
43
|
},
|
42
44
|
},
|
43
45
|
});
|
@@ -30,6 +30,7 @@ export default defineConfig({
|
|
30
30
|
- `inlineScript`:`boolean = true`,默认情况下,SSR 的数据会以内联脚本的方式注入到 HTML 中,并且直接赋值给全局变量。配置为 `false` 后,会下发 JSON,而不是赋值给全局变量。
|
31
31
|
- `disablePrerender`: `boolean = fasle`, 为了兼容旧数据请求方式 - `useLoader`, 默认情况下 Modern.js 会对组件进行一次预渲染即有两次渲染。
|
32
32
|
开发者在保证项目中没有使用 useLoader Api 情况下, 可通过配置 `disablePrerender=true`来减少一次渲染。
|
33
|
+
- `unsafeHeaders`: `string[] = []`, 为了安全考虑,Modern.js 不会往 SSR_DATA 添加过多的内容。开发者可以通过该配置,对需要注入的 headers 进行配置。
|
33
34
|
|
34
35
|
```ts title="modern.config.ts"
|
35
36
|
export default defineConfig({
|
@@ -39,6 +40,7 @@ export default defineConfig({
|
|
39
40
|
mode: 'stream',
|
40
41
|
inlineScript: false,
|
41
42
|
disablePrerender: true,
|
43
|
+
unsafeHeaders: ['User-Agent'],
|
42
44
|
},
|
43
45
|
},
|
44
46
|
});
|
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-20231220170631",
|
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-20231220170631"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
|
-
"@modern-js/builder-doc": "0.0.0-nightly-
|
28
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20231220170631"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"classnames": "^2",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"@rspress/shared": "1.8.3",
|
40
40
|
"@types/node": "^16",
|
41
41
|
"@types/fs-extra": "9.0.13",
|
42
|
-
"@modern-js/
|
43
|
-
"@modern-js/doc
|
42
|
+
"@modern-js/doc-plugin-auto-sidebar": "0.0.0-nightly-20231220170631",
|
43
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20231220170631"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"dev": "rspress dev",
|