@modern-js/main-doc 2.28.0 → 2.30.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +17 -0
- package/docs/en/community/contributing-guide.mdx +8 -9
- package/docs/en/configure/app/performance/dns-prefetch.mdx +13 -0
- package/docs/en/configure/app/performance/preconnect.mdx +13 -0
- package/docs/en/configure/app/performance/prefetch.mdx +13 -0
- package/docs/en/configure/app/performance/preload.mdx +13 -0
- package/docs/en/configure/app/performance/transform-lodash.mdx +13 -0
- package/docs/en/guides/troubleshooting/dependencies.mdx +15 -2
- package/docs/zh/community/contributing-guide.mdx +8 -9
- package/docs/zh/configure/app/performance/dns-prefetch.mdx +13 -0
- package/docs/zh/configure/app/performance/preconnect.mdx +13 -0
- package/docs/zh/configure/app/performance/prefetch.mdx +13 -0
- package/docs/zh/configure/app/performance/preload.mdx +13 -0
- package/docs/zh/configure/app/performance/transform-lodash.mdx +13 -0
- package/docs/zh/guides/troubleshooting/dependencies.mdx +15 -2
- package/package.json +5 -5
- package/src/components/Footer/index.tsx +2 -3
- package/src/i18n/enUS.ts +2 -2
- package/src/i18n/zhCN.ts +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# @modern-js/main-doc
|
2
2
|
|
3
|
+
## 2.30.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- cc5f49e: feat(builder): add performance.transformLodash config
|
8
|
+
|
9
|
+
feat(builder): 新增 performance.transformLodash 配置
|
10
|
+
|
11
|
+
- Updated dependencies [cc5f49e]
|
12
|
+
- @modern-js/builder-doc@2.30.0
|
13
|
+
|
14
|
+
## 2.29.0
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- @modern-js/builder-doc@2.29.0
|
19
|
+
|
3
20
|
## 2.28.0
|
4
21
|
|
5
22
|
### Patch Changes
|
@@ -17,26 +17,25 @@ own GitHub account and then [clone](https://help.github.com/articles/cloning-a-r
|
|
17
17
|
|
18
18
|
### Install Node.js
|
19
19
|
|
20
|
-
We recommend using Node.js
|
20
|
+
We recommend using Node.js 18. You can check your currently used Node.js version with the following command:
|
21
21
|
|
22
22
|
```bash
|
23
23
|
node -v
|
24
|
-
#v16.18.0
|
25
24
|
```
|
26
25
|
|
27
26
|
If you do not have Node.js installed in your current environment, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install it.
|
28
27
|
|
29
|
-
Here is an example of how to install the Node.js
|
28
|
+
Here is an example of how to install the Node.js 18 LTS version via nvm:
|
30
29
|
|
31
30
|
```bash
|
32
|
-
# Install the LTS version of Node.js
|
33
|
-
nvm install
|
31
|
+
# Install the LTS version of Node.js 18
|
32
|
+
nvm install 18 --lts
|
34
33
|
|
35
|
-
# Make the newly installed Node.js
|
36
|
-
nvm alias default
|
34
|
+
# Make the newly installed Node.js 18 as the default version
|
35
|
+
nvm alias default 18
|
37
36
|
|
38
|
-
# Switch to the newly installed Node.js
|
39
|
-
nvm use
|
37
|
+
# Switch to the newly installed Node.js 18
|
38
|
+
nvm use 18
|
40
39
|
```
|
41
40
|
|
42
41
|
### Install pnpm
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: dnsPrefetch
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.dnsPrefetch
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [performance.dnsPrefetch](https://modernjs.dev/builder/en/api/config-performance.html#performancednsprefetch).
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/en/config/performance/dnsPrefetch.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: preconnect
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.preconnect
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [performance.preconnect](https://modernjs.dev/builder/en/api/config-performance.html#performancepreconnect).
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/en/config/performance/preconnect.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: prefetch
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.prefetch
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [performance.prefetch](https://modernjs.dev/builder/en/api/config-performance.html#performanceprefetch).
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/en/config/performance/prefetch.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: preload
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.preload
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [performance.preload](https://modernjs.dev/builder/en/api/config-performance.html#performancepreload).
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/en/config/performance/preload.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: transformLodash
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.transformLodash
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
This config is provided by Modern.js Builder, more detail can see [performance.transformLodash](https://modernjs.dev/builder/en/api/config-performance.html#performancetransformlodash).
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/en/config/performance/transformLodash.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -46,7 +46,7 @@ The engine "node" is incompatible with this module.
|
|
46
46
|
Expected version ">=14.17.6". Got "12.20.1"
|
47
47
|
```
|
48
48
|
|
49
|
-
When using Modern.js, it is recommended to use the latest version of [Node.js
|
49
|
+
When using Modern.js, it is recommended to use the latest version of [Node.js 18.x](https://nodejs.org/download/release/latest-v18.x/).
|
50
50
|
|
51
51
|
If the Node.js version of the current environment is lower than the above requirement, you can use tools such as [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to switch versions.
|
52
52
|
|
@@ -104,7 +104,20 @@ In most cases, peer dependencies warnings will not affect the project operation
|
|
104
104
|
|
105
105
|
**The recommended React version for the Modern.js framework is >= 18.0.0**, and different functions have different requirements for the React version.
|
106
106
|
|
107
|
-
- If you are using React 17, some framework functions will not be available, such as
|
107
|
+
- If you are using React 17, some framework functions will not be available, such as Streaming SSR, because it relies on new features provided by React 18.
|
108
108
|
- If you are still using React 16, you will not be able to use Modern.js's runtime or server-side capabilities. You can consider using the build mode of Modern.js, that is, only using Modern.js's build capabilities. In this case, React 16 can still be used.
|
109
109
|
|
110
110
|
In future major versions of Modern.js, we will gradually remove support for React 16 and React 17. Therefore, please upgrade to React 18 or higher as soon as possible.
|
111
|
+
|
112
|
+
---
|
113
|
+
|
114
|
+
### Type error in Modern.js configuration file?
|
115
|
+
|
116
|
+
```bash
|
117
|
+
Type 'CliPlugin<{}, {}, {}, {}>' is not assignable to type 'CliPlugin<any, {}, {}, {}>'.
|
118
|
+
Types of property 'setup' are incompatible.
|
119
|
+
```
|
120
|
+
|
121
|
+
When you use the Modern.js framework, the above error occurs in the configuration file, it may be due to the inconsistent versions of Modern.js related packages。You can upgrade and unify the version of modern.js related packages through `npx modern upgrade` command.
|
122
|
+
|
123
|
+
In the monorepo, the above error may also occur due to inconsistent versions of the Modern.js framework used by different sub-projects.
|
@@ -16,26 +16,25 @@ sidebar_position: 3
|
|
16
16
|
|
17
17
|
### 安装 Node.js
|
18
18
|
|
19
|
-
我们推荐使用 Node.js
|
19
|
+
我们推荐使用 Node.js 18。你可以通过以下命令查看当前使用的 Node.js 版本:
|
20
20
|
|
21
21
|
```bash
|
22
22
|
node -v
|
23
|
-
#v16.18.0
|
24
23
|
```
|
25
24
|
|
26
25
|
如果你当前环境没有安装 Node.js,可以使用 [nvm](https://github.com/nvm-sh/nvm)或者 [fnm](https://github.com/Schniz/fnm) 来安装它。
|
27
26
|
|
28
|
-
以下是如何通过 nvm 安装 Node.js
|
27
|
+
以下是如何通过 nvm 安装 Node.js 18 LTS 版本的示例:
|
29
28
|
|
30
29
|
```bash
|
31
|
-
# 安装 Node.js
|
32
|
-
nvm install
|
30
|
+
# 安装 Node.js 18 的 LTS 版本
|
31
|
+
nvm install 18 --lts
|
33
32
|
|
34
|
-
# 将新安装的 Node.js
|
35
|
-
nvm alias default
|
33
|
+
# 将新安装的 Node.js 18 设为默认版本
|
34
|
+
nvm alias default 18
|
36
35
|
|
37
|
-
# 切换到新安装的 Node.js
|
38
|
-
nvm use
|
36
|
+
# 切换到新安装的 Node.js 18
|
37
|
+
nvm use 18
|
39
38
|
```
|
40
39
|
|
41
40
|
### 安装 pnpm
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: dnsPrefetch
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.dnsPrefetch
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [performance.dnsPrefetch](https://modernjs.dev/builder/api/config-performance.html#performancednsprefetch)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/performance/dnsPrefetch.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: preconnect
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.preconnect
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [performance.preconnect](https://modernjs.dev/builder/api/config-performance.html#performancepreconnect)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/performance/preconnect.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: prefetch
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.prefetch
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [performance.prefetch](https://modernjs.dev/builder/api/config-performance.html#performanceprefetch)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/performance/prefetch.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: preload
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.preload
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [performance.preload](https://modernjs.dev/builder/api/config-performance.html#performancepreload)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/performance/preload.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: transformLodash
|
3
|
+
---
|
4
|
+
|
5
|
+
# performance.transformLodash
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [performance.transformLodash](https://modernjs.dev/builder/api/config-performance.html#performancetransformlodash)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/performance/transformLodash.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -46,7 +46,7 @@ The engine "node" is incompatible with this module.
|
|
46
46
|
Expected version ">=14.17.6". Got "12.20.1"
|
47
47
|
```
|
48
48
|
|
49
|
-
使用 Modern.js 时,建议使用 [Node.js
|
49
|
+
使用 Modern.js 时,建议使用 [Node.js 18.x](https://nodejs.org/download/release/latest-v18.x/) 的最新版本。
|
50
50
|
|
51
51
|
如果当前环境的 Node.js 版本低于上述要求的版本,则可以使用 [nvm](https://github.com/nvm-sh/nvm) 或 [fnm](https://github.com/Schniz/fnm) 等工具进行版本切换。
|
52
52
|
|
@@ -104,7 +104,20 @@ Type '{}' is not assignable to type 'ReactNode'.
|
|
104
104
|
|
105
105
|
**Modern.js 框架推荐使用的 React 版本为 >= 18.0.0**,并且不同功能对 React 版本的要求有所不同。
|
106
106
|
|
107
|
-
- 如果你在使用 React 17,那么部分框架功能将无法使用,比如
|
107
|
+
- 如果你在使用 React 17,那么部分框架功能将无法使用,比如 Streaming SSR,因为它依赖 React 18 提供的新特性。
|
108
108
|
- 如果你仍然在使用 React 16,那么将无法使用 Modern.js 的运行时或服务端能力。你可以考虑使用 Modern.js 的构建模式,即只使用 Modern.js 的构建能力,这种情况可以继续使用 React 16。
|
109
109
|
|
110
110
|
在 Modern.js 未来的 major 版本中,我们会逐步移除对 React 16 和 React 17 的支持。因此,请尽快升级到 React 18 以上版本。
|
111
|
+
|
112
|
+
---
|
113
|
+
|
114
|
+
### Modern.js 配置出现类型错误?
|
115
|
+
|
116
|
+
```bash
|
117
|
+
Type 'CliPlugin<{}, {}, {}, {}>' is not assignable to type 'CliPlugin<any, {}, {}, {}>'.
|
118
|
+
Types of property 'setup' are incompatible.
|
119
|
+
```
|
120
|
+
|
121
|
+
当你在使用 Modern.js 框架时配置文件出现以上报错,可能是由于 Modern.js 相关包的版本号未统一导致。可以通过 `npx modern upgrade` 命令对 modern.js 依赖进行升级和版本统一。
|
122
|
+
|
123
|
+
在 monorepo 中由于不同子项目所用的 Modern.js 框架版本不一致也可能出现以上问题。
|
package/package.json
CHANGED
@@ -15,14 +15,14 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.30.0",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"peerDependencies": {
|
25
|
-
"@modern-js/builder-doc": "^2.
|
25
|
+
"@modern-js/builder-doc": "^2.30.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"classnames": "^2",
|
@@ -34,9 +34,9 @@
|
|
34
34
|
"fs-extra": "^10",
|
35
35
|
"@types/node": "^16",
|
36
36
|
"@types/fs-extra": "^9",
|
37
|
-
"@modern-js/builder-doc": "2.
|
38
|
-
"@modern-js/doc-
|
39
|
-
"@modern-js/doc-
|
37
|
+
"@modern-js/builder-doc": "2.30.0",
|
38
|
+
"@modern-js/doc-tools": "2.30.0",
|
39
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.30.0"
|
40
40
|
},
|
41
41
|
"scripts": {
|
42
42
|
"dev": "modern dev",
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import React from 'react';
|
2
1
|
import { useI18n, useUrl } from '../../i18n';
|
3
2
|
import styles from './styles.module.scss';
|
4
3
|
|
@@ -35,11 +34,11 @@ export default function Footer() {
|
|
35
34
|
},
|
36
35
|
{
|
37
36
|
label: t('basicFeatures'),
|
38
|
-
to: useUrl('/guides/basic-features/'),
|
37
|
+
to: useUrl('/guides/basic-features/routes'),
|
39
38
|
},
|
40
39
|
{
|
41
40
|
label: t('advancedFeatures'),
|
42
|
-
to: useUrl('/guides/advanced-features/'),
|
41
|
+
to: useUrl('/guides/advanced-features/rspack-start'),
|
43
42
|
},
|
44
43
|
],
|
45
44
|
},
|
package/src/i18n/enUS.ts
CHANGED
@@ -27,8 +27,8 @@ export const EN_US = {
|
|
27
27
|
solutions: 'Solutions',
|
28
28
|
solutionsDesc1: 'A progressive React framework for web development.',
|
29
29
|
solutionsDesc2: 'A powerful solution for npm package development.',
|
30
|
-
solutionsDesc3: 'A documentation site solution
|
31
|
-
solutionsDesc4: 'A
|
30
|
+
solutionsDesc3: 'A Rspack based documentation site solution.',
|
31
|
+
solutionsDesc4: 'A build engine for web development.',
|
32
32
|
|
33
33
|
// Footer
|
34
34
|
guide: 'Guide',
|
package/src/i18n/zhCN.ts
CHANGED
@@ -27,7 +27,7 @@ export const ZH_CN: Record<keyof typeof EN_US, string> = {
|
|
27
27
|
solutions: '解决方案',
|
28
28
|
solutionsDesc1: '基于 React 的渐进式 Web 开发框架。',
|
29
29
|
solutionsDesc2: '简单、高性能的 npm 包开发方案。',
|
30
|
-
solutionsDesc3: '
|
30
|
+
solutionsDesc3: '基于 Rspack 的文档站解决方案。',
|
31
31
|
solutionsDesc4: '面向 Web 开发场景的构建引擎。',
|
32
32
|
|
33
33
|
// Footer
|