@modern-js/main-doc 3.1.5 → 3.2.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/components/international/init-options-desc.mdx +1 -1
- package/docs/en/components/international/install-command.mdx +4 -17
- package/docs/en/components/international/instance-code.mdx +4 -14
- package/docs/en/components/international/introduce.mdx +4 -1
- package/docs/en/configure/app/source/enable-async-pre-entry.mdx +30 -0
- package/docs/en/configure/app/tools/dev-server.mdx +0 -4
- package/docs/en/guides/advanced-features/international/_meta.json +0 -1
- package/docs/en/guides/advanced-features/international/advanced.mdx +48 -109
- package/docs/en/guides/advanced-features/international/api.mdx +125 -290
- package/docs/en/guides/advanced-features/international/best-practices.mdx +203 -48
- package/docs/en/guides/advanced-features/international/configuration.mdx +108 -315
- package/docs/en/guides/advanced-features/international/locale-detection.mdx +62 -208
- package/docs/en/guides/advanced-features/international/quick-start.mdx +41 -55
- package/docs/en/guides/advanced-features/international/resource-loading.mdx +63 -322
- package/docs/en/guides/advanced-features/international/routing.mdx +60 -138
- package/docs/en/guides/advanced-features/international.mdx +19 -27
- package/docs/en/guides/basic-features/alias.mdx +1 -1
- package/docs/en/guides/basic-features/html.mdx +2 -2
- package/docs/en/guides/basic-features/static-assets.mdx +1 -2
- package/docs/en/guides/concept/entries.mdx +2 -2
- package/docs/zh/components/international/init-options-desc.mdx +1 -1
- package/docs/zh/components/international/install-command.mdx +4 -16
- package/docs/zh/components/international/instance-code.mdx +4 -14
- package/docs/zh/components/international/introduce.mdx +5 -2
- package/docs/zh/configure/app/source/enable-async-pre-entry.mdx +77 -0
- package/docs/zh/configure/app/tools/dev-server.mdx +0 -4
- package/docs/zh/guides/advanced-features/bff/function.mdx +2 -2
- package/docs/zh/guides/advanced-features/international/_meta.json +0 -1
- package/docs/zh/guides/advanced-features/international/advanced.mdx +48 -109
- package/docs/zh/guides/advanced-features/international/api.mdx +126 -292
- package/docs/zh/guides/advanced-features/international/best-practices.mdx +204 -49
- package/docs/zh/guides/advanced-features/international/configuration.mdx +105 -318
- package/docs/zh/guides/advanced-features/international/locale-detection.mdx +62 -236
- package/docs/zh/guides/advanced-features/international/quick-start.mdx +40 -54
- package/docs/zh/guides/advanced-features/international/resource-loading.mdx +62 -324
- package/docs/zh/guides/advanced-features/international/routing.mdx +58 -136
- package/docs/zh/guides/advanced-features/international.mdx +19 -26
- package/docs/zh/guides/basic-features/alias.mdx +1 -1
- package/docs/zh/guides/basic-features/html.mdx +2 -2
- package/docs/zh/guides/basic-features/static-assets.mdx +1 -2
- package/docs/zh/guides/concept/entries.mdx +2 -2
- package/package.json +4 -4
- package/docs/en/components/rspackPrecautions.mdx +0 -6
- package/docs/en/guides/advanced-features/international/basic.mdx +0 -417
- package/docs/zh/components/rspackPrecautions.mdx +0 -6
- package/docs/zh/guides/advanced-features/international/basic.mdx +0 -416
|
@@ -4,149 +4,101 @@ title: 路由集成
|
|
|
4
4
|
|
|
5
5
|
# 路由集成
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 启用语言路径前缀
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
设置 `localePathRedirect: true` 后,插件会接管 URL 中的语言识别和跳转,具体做以下四件事:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
1. **识别 URL 里的语言前缀**:访问 `/zh/detail` 时,插件从路径中提取 `zh` 作为当前语言
|
|
12
|
+
2. **无前缀路径自动重定向**:访问 `/detail` 时,先通过 detector 检测语言,检测不到则用 `fallbackLanguage`,然后重定向到 `/en/detail` 或 `/zh/detail`
|
|
13
|
+
3. **切换语言时同步更新 URL**:当前在 `/en/detail`,调用 `changeLanguage('zh')` 后 URL 自动变为 `/zh/detail`,而不只是改 i18next 内部的语言状态
|
|
14
|
+
4. **避免路径被重复检测**:插件会自动从 i18next detector 的 `order` 中移除 `path`,因为路径语言识别已由插件自己处理,不需要 i18next 再检测一遍
|
|
14
15
|
|
|
15
16
|
```ts
|
|
17
|
+
// modern.config.ts
|
|
16
18
|
i18nPlugin({
|
|
17
19
|
localeDetection: {
|
|
18
20
|
localePathRedirect: true,
|
|
19
21
|
languages: ['zh', 'en'],
|
|
20
22
|
fallbackLanguage: 'en',
|
|
21
|
-
// 可选:忽略某些路由的自动重定向
|
|
22
|
-
ignoreRedirectRoutes: ['/api', '/admin'],
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
某些路由(如 API 路由、静态资源等)不需要语言前缀,可以使用 `ignoreRedirectRoutes` 配置来忽略这些路由的自动重定向:
|
|
27
|
+
**效果:**
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fallbackLanguage: 'en',
|
|
37
|
-
// 字符串数组:支持精确匹配和前缀匹配
|
|
38
|
-
ignoreRedirectRoutes: ['/api', '/admin', '/static'],
|
|
39
|
-
// 或使用函数进行更灵活的判断
|
|
40
|
-
ignoreRedirectRoutes: pathname => {
|
|
41
|
-
return pathname.startsWith('/api') || pathname.startsWith('/admin');
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
```
|
|
29
|
+
| 访问路径 | 结果 |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| `/about` | 重定向到 `/en/about` |
|
|
32
|
+
| `/en/about` | 正常访问,语言为 `en` |
|
|
33
|
+
| `/zh/about` | 正常访问,语言为 `zh` |
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
某些路径(如 API 路由、静态资源)不需要语言前缀,可以通过 `ignoreRedirectRoutes` 跳过重定向,详见[语言检测 → ignoreRedirectRoutes](./locale-detection.md#ignoreredirectroutes)。
|
|
48
36
|
|
|
49
37
|
## 路由配置
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
启用 `localePathRedirect` 后,需要在路由中添加 `[lang]` 动态参数来接收语言前缀。
|
|
52
40
|
|
|
53
41
|
### 约定式路由
|
|
54
42
|
|
|
55
|
-
|
|
43
|
+
在 `routes/` 目录下创建 `[lang]` 目录:
|
|
56
44
|
|
|
57
|
-
```
|
|
45
|
+
```
|
|
58
46
|
routes/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
│ └── contact/
|
|
65
|
-
│ └── page.tsx # Contact 页面
|
|
47
|
+
└── [lang]/
|
|
48
|
+
├── layout.tsx ← 可在此读取 params.lang
|
|
49
|
+
├── page.tsx
|
|
50
|
+
└── about/
|
|
51
|
+
└── page.tsx
|
|
66
52
|
```
|
|
67
53
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
import { Outlet } from '@modern-js/runtime/router';
|
|
54
|
+
生成的路由结构:
|
|
72
55
|
|
|
73
|
-
export default function Layout() {
|
|
74
|
-
return <Outlet />;
|
|
75
|
-
}
|
|
76
56
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
export default function Home() {
|
|
82
|
-
return <div>Home</div>;
|
|
83
|
-
}
|
|
57
|
+
/:lang → page.tsx
|
|
58
|
+
/:lang/about → about/page.tsx
|
|
84
59
|
```
|
|
85
60
|
|
|
86
|
-
|
|
61
|
+
如果需要在布局或页面中读取当前语言参数:
|
|
87
62
|
|
|
88
63
|
```tsx
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
```
|
|
64
|
+
// routes/[lang]/layout.tsx
|
|
65
|
+
import { Outlet, useParams } from '@modern-js/runtime/router';
|
|
93
66
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return <
|
|
67
|
+
export default function Layout() {
|
|
68
|
+
const { lang } = useParams();
|
|
69
|
+
// lang 为当前 URL 中的语言代码,如 'en'、'zh'
|
|
70
|
+
// 通常不需要手动使用,useModernI18n() 会自动管理
|
|
71
|
+
return <Outlet />;
|
|
99
72
|
}
|
|
100
73
|
```
|
|
101
74
|
|
|
102
|
-
**生成的路由结构**:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
/:lang → Home 页面
|
|
106
|
-
/:lang/about → About 页面
|
|
107
|
-
/:lang/contact → Contact 页面
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
访问 `/` 或 `/about` 时,会自动重定向到 `/en` 或 `/en/about`(使用默认语言)。
|
|
111
|
-
|
|
112
75
|
### 自定义路由
|
|
113
76
|
|
|
114
|
-
|
|
77
|
+
:::info
|
|
78
|
+
自定义路由仅在不使用 Modern.js 约定路由系统时才需要。大多数项目推荐使用约定式路由。
|
|
79
|
+
:::
|
|
80
|
+
|
|
81
|
+
如果使用自定义路由文件(`modern.routes.ts`),需要手动添加 `:lang` 参数:
|
|
115
82
|
|
|
116
83
|
```tsx
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Outlet,
|
|
122
|
-
} from '@modern-js/runtime/router';
|
|
123
|
-
|
|
124
|
-
function App() {
|
|
84
|
+
// modern.routes.ts
|
|
85
|
+
import { Route, Routes, Outlet } from '@modern-js/runtime/router';
|
|
86
|
+
|
|
87
|
+
export default function App() {
|
|
125
88
|
return (
|
|
126
|
-
<
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
<Route path="
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<Route path="contact" element={<Contact />} />
|
|
133
|
-
</Route>
|
|
134
|
-
</Routes>
|
|
135
|
-
</BrowserRouter>
|
|
89
|
+
<Routes>
|
|
90
|
+
<Route path=":lang" element={<Outlet />}>
|
|
91
|
+
<Route index element={<Home />} />
|
|
92
|
+
<Route path="about" element={<About />} />
|
|
93
|
+
</Route>
|
|
94
|
+
</Routes>
|
|
136
95
|
);
|
|
137
96
|
}
|
|
138
97
|
```
|
|
139
98
|
|
|
140
|
-
:::info
|
|
141
|
-
约定式路由会自动根据文件结构生成对应的路由,推荐使用约定式路由。只有在需要特殊路由控制时才使用自定义路由。
|
|
142
|
-
|
|
143
|
-
:::
|
|
144
|
-
|
|
145
99
|
## I18nLink 组件
|
|
146
100
|
|
|
147
|
-
`I18nLink`
|
|
148
|
-
|
|
149
|
-
### 基本用法
|
|
101
|
+
`I18nLink` 是语言感知的链接组件,会自动在目标路径前添加当前语言前缀,无需手动拼接。
|
|
150
102
|
|
|
151
103
|
```tsx
|
|
152
104
|
import { I18nLink } from '@modern-js/plugin-i18n/runtime';
|
|
@@ -156,57 +108,27 @@ function Navigation() {
|
|
|
156
108
|
<nav>
|
|
157
109
|
<I18nLink to="/">首页</I18nLink>
|
|
158
110
|
<I18nLink to="/about">关于</I18nLink>
|
|
159
|
-
<I18nLink to="/contact">联系</I18nLink>
|
|
111
|
+
<I18nLink to="/contact" replace>联系</I18nLink>
|
|
160
112
|
</nav>
|
|
161
113
|
);
|
|
162
114
|
}
|
|
163
115
|
```
|
|
164
116
|
|
|
165
|
-
**当前语言为 `en`
|
|
166
|
-
|
|
167
|
-
- `<I18nLink to="/">` → 实际链接:`/en`
|
|
168
|
-
- `<I18nLink to="/about">` → 实际链接:`/en/about`
|
|
117
|
+
**当前语言为 `en` 时:**
|
|
169
118
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
### 自动添加语言前缀
|
|
119
|
+
```
|
|
120
|
+
<I18nLink to="/about"> → 实际链接:/en/about
|
|
121
|
+
<I18nLink to="/"> → 实际链接:/en
|
|
122
|
+
```
|
|
176
123
|
|
|
177
|
-
|
|
124
|
+
**注意事项:**
|
|
178
125
|
|
|
179
126
|
```tsx
|
|
180
127
|
// ✅ 正确:不需要手动添加语言前缀
|
|
181
128
|
<I18nLink to="/about">关于</I18nLink>
|
|
182
129
|
|
|
183
|
-
// ❌
|
|
130
|
+
// ❌ 错误:不要手动添加语言前缀,会导致 /en/en/about
|
|
184
131
|
<I18nLink to="/en/about">关于</I18nLink>
|
|
185
132
|
```
|
|
186
133
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`I18nLink` 接受所有 `Link` 组件的 props,并额外支持:
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
interface I18nLinkProps {
|
|
193
|
-
/** 目标路径(不需要包含语言前缀) */
|
|
194
|
-
to: string;
|
|
195
|
-
/** 子元素 */
|
|
196
|
-
children: React.ReactNode;
|
|
197
|
-
/** 其他 Link 组件的 props */
|
|
198
|
-
[key: string]: any;
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**示例**:
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
<I18nLink to="/about" replace>
|
|
206
|
-
关于
|
|
207
|
-
</I18nLink>
|
|
208
|
-
|
|
209
|
-
<I18nLink to="/contact" state={{ from: 'home' }}>
|
|
210
|
-
联系
|
|
211
|
-
</I18nLink>
|
|
212
|
-
```
|
|
134
|
+
`I18nLink` 继承自 `@modern-js/runtime/router` 的 `Link` 组件,支持 `replace`、`state`、`className` 等所有标准 Link props,完整 Props 类型见 [API 参考](./api.md#i18nlink-组件)。
|
|
@@ -8,29 +8,22 @@ import I18nPluginIntroduce from '@site-docs/components/international/introduce';
|
|
|
8
8
|
|
|
9
9
|
<I18nPluginIntroduce />
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
- [配置说明](./international/configuration) - CLI 和运行时配置详解
|
|
31
|
-
- [语言检测](./international/locale-detection) - 多种语言检测方式和优先级
|
|
32
|
-
- [资源加载](./international/resource-loading) - HTTP、FS、SDK 三种后端使用
|
|
33
|
-
- [路由集成](./international/routing) - 路径重定向和 I18nLink 组件
|
|
34
|
-
- [API 参考](./international/api) - 完整的 API 文档和类型定义
|
|
35
|
-
- [高级用法](./international/advanced) - SSR、多入口、自定义实例等
|
|
36
|
-
- [最佳实践](./international/best-practices) - 资源组织、错误处理、类型安全
|
|
11
|
+
## 从哪里开始?
|
|
12
|
+
|
|
13
|
+
| 想做的事 | 文档 |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| 首次接入,跑通示例 | [快速开始](./international/quick-start.md) |
|
|
16
|
+
| 了解完整的配置选项 | [配置说明](./international/configuration.md) |
|
|
17
|
+
| 根据 URL / Cookie / Header 自动判断语言 | [语言检测](./international/locale-detection.md) |
|
|
18
|
+
| 实现 `/en/about` 这类带语言前缀的路径 | [路由集成](./international/routing.md) |
|
|
19
|
+
| 从远程服务或平台加载翻译资源 | [资源加载 → 自定义后端](./international/resource-loading.md#sdk-后端) |
|
|
20
|
+
| SSR 场景、多入口、自定义实例 | [高级用法](./international/advanced.md) |
|
|
21
|
+
| 查询 Hook / 组件 / 类型定义 | [API 参考](./international/api.md) |
|
|
22
|
+
|
|
23
|
+
## 核心能力
|
|
24
|
+
|
|
25
|
+
- **语言检测**:支持 URL 路径、Cookie、LocalStorage、请求头、浏览器设置等多种检测方式,可自由组合优先级
|
|
26
|
+
- **资源加载**:支持 HTTP 静态文件、文件系统(SSR)、SDK 自定义函数三种后端,以及链式后端渐进加载
|
|
27
|
+
- **路由集成**:自动添加语言路径前缀(`/en/about`),提供 `I18nLink` 组件处理语言感知导航
|
|
28
|
+
- **SSR 支持**:服务端检测语言并注入到页面,客户端直接使用,避免语言闪烁
|
|
29
|
+
- **TypeScript 支持**:完整类型定义,支持翻译键类型安全检查
|
|
@@ -35,7 +35,7 @@ sidebar_position: 4
|
|
|
35
35
|
|
|
36
36
|
## 通过 `source.alias` 配置
|
|
37
37
|
|
|
38
|
-
Modern.js 提供了 [source.alias](/configure/app/source/alias)
|
|
38
|
+
Modern.js 提供了 [source.alias](/configure/app/source/alias) 配置项,你可以通过对象或者函数的方式来配置这个选项。
|
|
39
39
|
|
|
40
40
|
### 使用场景
|
|
41
41
|
|
|
@@ -193,7 +193,7 @@ Modern.js 也支持通过 HTML(EJS) 语法来生成 HTML 文件。
|
|
|
193
193
|
<head>
|
|
194
194
|
<%= topTemplate %>
|
|
195
195
|
<%= headTemplate %>
|
|
196
|
-
{/*
|
|
196
|
+
{/* rspack inject css */}
|
|
197
197
|
</head>
|
|
198
198
|
<body>
|
|
199
199
|
<noscript>
|
|
@@ -202,7 +202,7 @@ Modern.js 也支持通过 HTML(EJS) 语法来生成 HTML 文件。
|
|
|
202
202
|
</noscript>
|
|
203
203
|
<div id="<%= mountId %>"></div>
|
|
204
204
|
<%= bodyTemplate %>
|
|
205
|
-
{/*
|
|
205
|
+
{/* rspack inject js */}
|
|
206
206
|
{/* <?- bottomTemplate ?> */}
|
|
207
207
|
</body>
|
|
208
208
|
</html>
|
|
@@ -119,7 +119,7 @@ declare module '*.png' {
|
|
|
119
119
|
|
|
120
120
|
## 扩展静态资源类型
|
|
121
121
|
|
|
122
|
-
如果 Modern.js 内置的静态资源类型不能满足你的需求,那么你可以通过 [tools.bundlerChain](/configure/app/tools/bundler-chain) 来修改内置的
|
|
122
|
+
如果 Modern.js 内置的静态资源类型不能满足你的需求,那么你可以通过 [tools.bundlerChain](/configure/app/tools/bundler-chain) 来修改内置的 Rspack 配置,并扩展你需要的静态资源类型。
|
|
123
123
|
|
|
124
124
|
比如,你需要把 `*.pdf` 文件当做静态资源直接输出到产物目录,可以添加以下配置:
|
|
125
125
|
|
|
@@ -147,7 +147,6 @@ console.log(myFile); // "/static/myFile.6c12aba3.pdf"
|
|
|
147
147
|
关于以上配置的更多介绍,请参考:
|
|
148
148
|
|
|
149
149
|
- [Rspack 文档 - Asset modules](https://rspack.rs/guide/asset-module.html#asset-modules)
|
|
150
|
-
- [webpack 文档 - Asset modules](https://webpack.js.org/guides/asset-modules/)
|
|
151
150
|
|
|
152
151
|
## 图片格式
|
|
153
152
|
|
|
@@ -273,13 +273,13 @@ export default defineConfig({
|
|
|
273
273
|
|
|
274
274
|
## 深入了解
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
页面通常与 HTML 产物对应,即每增加一个入口最终就会在产物中生成一份对应的 HTML 文件。入口引入的模块会在编译打包后生成多个 Chunk 产物,例如对于 JavaScript 模块最终可能会生成数个类似 `dist/static/js/index.ea39u8.js` 的文件产物。
|
|
277
277
|
|
|
278
278
|
需要注意区分入口、路由等概念之间的关系:
|
|
279
279
|
|
|
280
280
|
- **入口**:包含多个用于启动时执行的模块。
|
|
281
281
|
- **客户端路由**:在 Modern.js 中通常由 `react-router` 实现,通过 History API 判断浏览器当前 URL 决定加载和显示哪个 React 组件。
|
|
282
|
-
-
|
|
282
|
+
- **服务端路由**:由服务器根据请求 URL 决定返回什么内容。对于传统多页应用,不同 URL 通常会直接返回不同的 HTML 页面。对于使用客户端路由的单页应用,服务器一般会将非静态资源请求统一回退到入口 HTML,再由前端接管后续路由匹配与页面渲染
|
|
283
283
|
|
|
284
284
|
它们的对应关系如下:
|
|
285
285
|
|
package/package.json
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"modern",
|
|
17
17
|
"modern.js"
|
|
18
18
|
],
|
|
19
|
-
"version": "3.
|
|
19
|
+
"version": "3.2.0",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"registry": "https://registry.npmjs.org/",
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"mermaid": "^11.12.3",
|
|
26
|
-
"@modern-js/sandpack-react": "3.
|
|
26
|
+
"@modern-js/sandpack-react": "3.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"rsbuild-plugin-open-graph": "1.1.2",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"classnames": "^2.5.1",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"fs-extra": "^10.1.0",
|
|
40
|
-
"react": "^19.2.
|
|
41
|
-
"react-dom": "^19.2.
|
|
40
|
+
"react": "^19.2.6",
|
|
41
|
+
"react-dom": "^19.2.6",
|
|
42
42
|
"ts-node": "^10.9.2",
|
|
43
43
|
"typescript": "^5"
|
|
44
44
|
},
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
## Precautions
|
|
2
|
-
|
|
3
|
-
Before using Rspack, you need to be aware of the following:
|
|
4
|
-
|
|
5
|
-
- Rspack is compatible with most webpack plugins and almost all loaders, but there are still a few webpack plugins that cannot be used for now. For more details, see [Plugin Compatibility](https://rspack.rs/guide/compatibility/plugin).
|
|
6
|
-
- Rspack uses [SWC](https://rspack.rs/guide/features/builtin-swc-loader) by default for code transformation and compression. In rare cases, you may encounter bugs in SWC in edge cases. You can provide feedback via [SWC issues](https://github.com/swc-project/swc/issues).
|