@modern-js/main-doc 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +2 -2
  4. package/en/apis/app/commands.mdx +2 -0
  5. package/en/apis/app/runtime/model/connect.mdx +1 -1
  6. package/en/apis/app/runtime/model/model_.mdx +1 -1
  7. package/en/apis/app/runtime/model/use-model.mdx +1 -1
  8. package/en/apis/app/runtime/web-server/hook.mdx +2 -2
  9. package/en/apis/app/runtime/web-server/middleware.mdx +33 -9
  10. package/en/components/enable-bff.mdx +4 -4
  11. package/en/components/init-rspack-app.mdx +7 -0
  12. package/en/configure/app/bff/enable-handle-web.mdx +24 -0
  13. package/en/configure/app/server/enable-framework-ext.mdx +1 -1
  14. package/en/guides/advanced-features/bff/_category_.json +1 -1
  15. package/en/guides/advanced-features/eslint.mdx +30 -32
  16. package/en/guides/advanced-features/low-level.mdx +1 -1
  17. package/en/guides/advanced-features/rspack-start.mdx +13 -17
  18. package/en/guides/advanced-features/web-server.mdx +87 -20
  19. package/en/guides/concept/builder.mdx +1 -1
  20. package/en/guides/topic-detail/framework-plugin/extend.mdx +20 -19
  21. package/en/guides/topic-detail/framework-plugin/hook-list.mdx +156 -155
  22. package/en/guides/topic-detail/framework-plugin/hook.mdx +58 -43
  23. package/en/guides/topic-detail/framework-plugin/implement.mdx +47 -49
  24. package/en/guides/topic-detail/framework-plugin/introduction.mdx +22 -23
  25. package/en/guides/topic-detail/framework-plugin/plugin-api.mdx +13 -13
  26. package/en/guides/topic-detail/framework-plugin/relationship.mdx +30 -30
  27. package/en/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  28. package/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +17 -17
  29. package/en/guides/topic-detail/micro-frontend/c02-development.mdx +76 -78
  30. package/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +57 -51
  31. package/en/guides/topic-detail/micro-frontend/c04-communicate.mdx +11 -11
  32. package/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +13 -13
  33. package/en/guides/topic-detail/model/auto-actions.mdx +18 -21
  34. package/en/guides/topic-detail/model/computed-state.mdx +27 -25
  35. package/en/guides/topic-detail/model/define-model.mdx +14 -14
  36. package/en/guides/topic-detail/model/faq.mdx +12 -13
  37. package/en/guides/topic-detail/model/manage-effects.mdx +43 -52
  38. package/en/guides/topic-detail/model/model-communicate.mdx +47 -45
  39. package/en/guides/topic-detail/model/performance.mdx +22 -23
  40. package/en/guides/topic-detail/model/quick-start.mdx +29 -28
  41. package/en/guides/topic-detail/model/redux-integration.mdx +7 -7
  42. package/en/guides/topic-detail/model/test-model.mdx +11 -11
  43. package/en/guides/topic-detail/model/typescript-best-practice.mdx +16 -15
  44. package/en/guides/topic-detail/model/use-model.mdx +40 -45
  45. package/en/guides/topic-detail/model/use-out-of-modernjs.mdx +16 -16
  46. package/en/guides/troubleshooting/cli.mdx +2 -2
  47. package/package.json +5 -5
  48. package/zh/apis/app/commands.mdx +2 -0
  49. package/zh/apis/app/runtime/model/connect.mdx +1 -1
  50. package/zh/apis/app/runtime/model/model_.mdx +1 -1
  51. package/zh/apis/app/runtime/model/use-model.mdx +1 -1
  52. package/zh/apis/app/runtime/web-server/hook.mdx +2 -4
  53. package/zh/apis/app/runtime/web-server/middleware.mdx +30 -10
  54. package/zh/apis/monorepo/commands/gen-release-note.mdx +3 -3
  55. package/zh/components/enable-bff.mdx +4 -4
  56. package/zh/components/init-rspack-app.mdx +7 -0
  57. package/zh/components/release-note.mdx +1 -1
  58. package/zh/configure/app/bff/enable-handle-web.mdx +24 -0
  59. package/zh/configure/app/server/enable-framework-ext.mdx +1 -1
  60. package/zh/guides/advanced-features/bff/_category_.json +1 -1
  61. package/zh/guides/advanced-features/rspack-start.mdx +13 -17
  62. package/zh/guides/advanced-features/web-server.mdx +81 -16
  63. package/zh/guides/concept/builder.mdx +1 -1
  64. package/zh/guides/topic-detail/changesets/github.mdx +2 -2
  65. package/zh/guides/topic-detail/changesets/release-note.mdx +1 -1
  66. package/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +2 -2
  67. package/zh/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  68. package/zh/guides/topic-detail/model/faq.mdx +1 -1
  69. package/zh/guides/topic-detail/model/manage-effects.mdx +1 -1
  70. package/zh/guides/topic-detail/model/model-communicate.mdx +1 -1
  71. package/zh/guides/topic-detail/model/performance.mdx +1 -1
  72. package/zh/guides/topic-detail/model/quick-start.mdx +2 -2
  73. package/zh/guides/topic-detail/model/use-model.mdx +3 -3
@@ -1,29 +1,29 @@
1
1
  ---
2
- title: 插件之间的关系
2
+ title: Relationship
3
3
  sidebar_position: 4
4
4
  ---
5
- # 插件之间的关系
5
+ # Relationship between Plugins
6
6
 
7
- Modern.js 的插件配置对象提供了一系列的字段,用于控制插件顺序、互斥等能力,可用的字段如下:
7
+ The plugin configuration object in Modern.js provides a series of fields to control plugin order, mutual exclusion, and other capabilities. The available fields are as follows:
8
8
 
9
- - `name`: `string`,设置当前插件的名称。
10
- - `pre`: `string[]`,这些插件最终会调整到当前插件前面。
11
- - `post`: `string[]`,这些插件最终会调整到当前插件后面。
12
- - `rivals`: `string[]`,互斥插件,遇到这些插件时会报错。
13
- - `required`: `string[]`,必需插件,插件列表中没有对应的插件时会报错。
14
- - `usePlugin`: `CliPlugin[]`,注册其他插件。
9
+ - `name`: `string`, sets the name of the current plugin.
10
+ - `pre`: `string[]`, these plugins will be adjusted to be executed before the current plugin.
11
+ - `post`: `string[]`, these plugins will be adjusted to be executed after the current plugin.
12
+ - `rivals`: `string[]`, mutually exclusive plugins, an error will be thrown when encountering these plugins.
13
+ - `required`: `string[]`, required plugins, an error will be thrown when the corresponding plugin is not found in the plugin list.
14
+ - `usePlugin`: `CliPlugin[]`, registers other plugins.
15
15
 
16
- 通过以上参数可以实现插件的前置、后置、互斥、必需等逻辑。
16
+ The above parameters can be used to achieve plugin front, back, mutual exclusion, and mandatory logic.
17
17
 
18
- ## 插件排序
18
+ ## Plugin Sorting
19
19
 
20
- Modern.js 的插件通过 `pre`、`post` 参数来实现了插件排序的功能。
20
+ Modern.js plugins achieve plugin sorting functionality through the `pre` and `post` parameters.
21
21
 
22
- ### 前置插件
22
+ ### Pre
23
23
 
24
- 默认情况下,插件会按照添加顺序依次执行,通过 `pre` 字段可以声明前置执行的插件。
24
+ By default, plugins are executed in the order they are added. You can declare preceding plugins to be executed by using the `pre` field.
25
25
 
26
- 比如有下面两个插件:
26
+ For example, there are the following two plugins:
27
27
 
28
28
  ```ts title=foo.ts
29
29
  const foo = {
@@ -38,11 +38,11 @@ const bar = {
38
38
  };
39
39
  ```
40
40
 
41
- `bar` 插件在 `pre` 字段中配置了 `foo` 插件,因此 `foo` 插件一定会在 `bar` 插件之前执行。
41
+ The `bar` plugin configures the `foo` plugin in the `pre` field, so the'foo' plugin must be executed before the `bar` plugin.
42
42
 
43
- ### 后置插件
43
+ ### Post
44
44
 
45
- 同样的,通过 `post` 字段可以声明后置执行的插件。
45
+ Declare succeeding plugins to be executed by using the `post` field.
46
46
 
47
47
  ```ts title=foo.ts
48
48
  const foo = {
@@ -57,13 +57,13 @@ const bar = {
57
57
  };
58
58
  ```
59
59
 
60
- `bar` 插件在 `post` 字段中配置了 `foo` 插件,因此 `foo` 插件一定会在 `bar` 插件之后执行。
60
+ If you use the `post` parameter in the `bar` plugin's configuration and set it to `['foo']`, then the `foo` plugin will be executed after the `bar` plugin.
61
61
 
62
- ## 互斥插件
62
+ ## rivals
63
63
 
64
- 通过 `rivals` 字段可以声明插件间的互斥关系。
64
+ The rivals field can be used to declare a mutual exclusion relationship between plugins.
65
65
 
66
- 有下面两个插件:
66
+ there are two plugin:
67
67
 
68
68
  ```ts title=foo.ts
69
69
  const foo = {
@@ -78,13 +78,13 @@ const bar = {
78
78
  };
79
79
  ```
80
80
 
81
- `bar` 插件在 `rivals` 字段中配置了 `foo` 插件,因此同时添加了 `foo` 插件和 `bar` 插件就会报错。
81
+ The `bar` plugin has been configured with the `foo` plugin in the `rivals` field, therefore an error will be thrown if both the `foo` and `bar` plugins are added simultaneously.
82
82
 
83
- ## 必需插件
83
+ ## required
84
84
 
85
- 通过 `required` 字段可以声明插件间的依赖关系。
85
+ The `required` field can be used to declare a dependency relationship between plugins.
86
86
 
87
- 有下面两个插件:
87
+ there are two plugin:
88
88
 
89
89
  ```ts title=foo.ts
90
90
  const foo = {
@@ -99,11 +99,11 @@ const bar = {
99
99
  };
100
100
  ```
101
101
 
102
- `bar` 插件在 `required` 字段中配置了 `foo` 插件,因此使用 `bar` 插件时,如果未配置 `foo` 插件就会报错。
102
+ The `bar` plugin has been configured with the `foo` plugin in the `required` field. Therefore, an error will be thrown when using the `bar` plugin if the `foo` plugin is not configured.
103
103
 
104
- ## 注册插件
104
+ ## Register Plugin
105
105
 
106
- 当插件之间存在依赖关系时,我们也可以在一个插件中通过 `usePlugin` 主动注册另一个插件:
106
+ When there is a dependency relationship between plugins, we can also actively register another plugin in a plugin by using `usePlugin`.
107
107
 
108
108
  ```ts title=foo.ts
109
109
  const foo = () => ({
@@ -116,4 +116,4 @@ const bar = () => ({
116
116
  });
117
117
  ```
118
118
 
119
- 当使用者配置了 `bar` 插件时,`foo` 插件也会自动注册生效,使用者就不需要去额外注册 `foo` 插件了。
119
+ When the user configures the `bar` plugin, the foo plugin will also be automatically registered and activated. The user does not need to register the `foo` plugin separately.
@@ -41,7 +41,7 @@ Different plugin types will ask different questions. You can choose the plugin t
41
41
  After the execution of the create project command is completed, a project for developing the generator plugin will be generated accordingly, and the `meta` information will also be generated according to your selection in the `package.json`.
42
42
 
43
43
  :::info
44
- For generator plugin development, please refer to `@modern-js/generator-plugin-plugin`. [Source Code](https://github.com/modern-js-dev/modern.js/tree/main/packages/generator/plugins/generator-plugin)
44
+ For generator plugin development, please refer to `@modern-js/generator-plugin-plugin`. [Source Code](https://github.com/web-infra-dev/modern.js/tree/main/packages/generator/plugins/generator-plugin)
45
45
 
46
46
  :::
47
47
 
@@ -1,29 +1,29 @@
1
1
  ---
2
2
  sidebar_position: 1
3
- title: 微前端介绍
3
+ title: Introduction
4
4
  ---
5
- # 微前端介绍
5
+ # Introduction
6
6
 
7
- 微前端是一种类似于微服务的架构,是一种由独立交付的多个前端应用组成整体的架构风格,将前端应用分解成一些更小、更简单的能够独立开发、测试、部署的应用,而在用户看来仍然是内聚的单个产品。
7
+ Micro frontend is an architecture similar to microservices. It is an architectural style composed of multiple front-end applications delivered independently. It decomposes the front-end application into some smaller and simpler applications that can be independently developed, tested and deployed., while still a cohesive single product in the eyes of users.
8
8
 
9
- 它主要解决了两个问题:
9
+ It mainly solves two problems:
10
10
 
11
- - 随着项目迭代应用越来越庞大,难以维护。
12
- - 跨团队或跨部门协作开发项目导致效率低下的问题。
11
+ - As the iterative application of the project becomes larger and more difficult to maintain.
12
+ - Collaborative development of projects across teams or departments leads to inefficiencies.
13
13
 
14
- ## 微前端关键词
14
+ ## Keyword
15
15
 
16
- 在微前端研发模式中,应用会被分成 **主应用**、和 **子应用**。
16
+ In the micro frontend, applications are divided into **main application**, and **sub-applications**.
17
17
 
18
- - 主应用:微前端项目的基座工程,所有子应用都会由它来加载。
19
- - 子应用:独立开发、独立部署的应用,最终会被主应用加载。
18
+ - Main application: The base project of the micro frontend project, all sub-applications will be loaded by it.
19
+ - Sub-application: An application developed and deployed independently will eventually be loaded by the main application.
20
20
 
21
- ## 功能简介
21
+ ## Features
22
22
 
23
- - 基于 [Garfish](https://www.garfishjs.org/guide)
24
- - 生成器支持微前端应用
25
- - 支持 React 组件式引用微前端子应用
26
- - 支持 loading
27
- - 支持主应用线上、子应用线下调试模式
23
+ - Base on [Garfish](https://www.garfishjs.org/guide)
24
+ - Generator supports
25
+ - Support React component-based reference micro-front-end sub-application
26
+ - Support loading
27
+ - Support main application online and sub-application offline debugging mode
28
28
 
29
- 可以在 [体验微前端](/guides/topic-detail/micro-frontend/c02-development) 一节学习如何开发微前端主子应用。
29
+ You can learn how to develop a micro frontend master app in the section [Experience micro frontend](/guides/topic-detail/micro-frontend/c02-development).
@@ -1,56 +1,56 @@
1
1
  ---
2
2
  sidebar_position: 2
3
- title: 体验微前端
3
+ title: development
4
4
  ---
5
- # 体验微前端
6
5
 
7
- 通过本章你可以了解到:
6
+ # Experience Micro Frontend
8
7
 
9
- - 如何创建微前端项目的主应用、子应用。
10
- - 微前端项目开发的基本流程。
8
+ Through this chapter you can learn:
11
9
 
12
- ## 创建应用
13
- 目前支持两种路由模式
14
- - 自控式路由
15
- - 约定式路由
10
+ - How to create the main application and sub-application of the micro frontend project.
11
+ - Basic process of micro frontend project development.
16
12
 
17
- 首先明确主应用的路由模式 [创建约定式路由主应用](#创建约定式路由主应用) [创建自控式路由主应用](#创建自控式路由主应用)
13
+ ## Create an app
18
14
 
19
- 在本次体验中我们会为主应用创建两个子应用 Table Dashboard (Table 为约定式路由,Dashboard 为自控式路由)
15
+ Currently supports two routing modes
16
+ - Self-controlled routing
17
+ - Conventional routing
20
18
 
21
- ### 创建约定式路由主应用
19
+ First, clarify the routing mode of the main application [create a conventional routing main application](#创建约定式路由主应用) or [create a self-controlled routing main application](#创建自控式路由主应用)
22
20
 
23
- 通过命令行工具初始化项目:
21
+ In this experience we will create two sub-applications Table and Dashboard for the main application (Table is reduced routing, Dashboard is self-controlled routing)
22
+
23
+
24
+ ### File-based Routing Main App
25
+
26
+ Initialize the project with a command line:
24
27
 
25
28
  ```bash
26
29
  mkdir masterApp && cd masterApp
27
30
  npx @modern-js/create
28
31
  ```
29
32
 
30
- import DefaultMWAGenerate from "@site-docs/components/default-mwa-generate";
31
-
32
- <DefaultMWAGenerate />
33
-
34
- 完成项目创建后我们可以通过 `pnpm run new` 来开启 `微前端` 功能:
33
+ After the project is created, we can enable the `micro frontend` through `pnpm run new`:
35
34
 
36
35
  ```bash
37
- ? 请选择你想要的操作 启用可选功能
38
- ? 启用可选功能 启用「微前端」模式
36
+ ? Action Enable features
37
+ ? Enable features Enable Micro Front-end Feature
39
38
  ```
40
39
 
41
- 接下来,让我们注册微前端插件并添加开启微前端主应用,并增加子应用列表:
40
+ Next, let's register the micro frontend plugin and add the main micro frontend app and add the list of sub-apps:
42
41
 
43
42
  import EnableMicroFrontend from "@site-docs/components/enable-micro-frontend";
44
43
 
45
44
  <EnableMicroFrontend />
46
45
 
47
- 然后我们在 routes 文件夹下新建两个目录
48
- - table (用于加载约定式路由子应用)
49
- - dashboard (用于加载自控式路由子应用)
46
+ Then we create two new directories in the routes folder
47
+ - table (for loading conventional routing sub-applications)
48
+ - dashboard (for loading self-controlled routing sub-applications)
50
49
 
51
- 在这两个目录下我们需要新建一个 `$.tsx` 文件作为主应用约定式路由的入口($ 代表模糊匹配,即 `/table` `/table/test` 都会匹配到这个 `$.tsx` 作为该路由的入口文件,这会保证在微前端场景下正确加载子应用路由)
50
+ In these two directories, we need to create a `$.tsx` file as the entry of the main application convention route ($represents fuzzy match, that is, `/table` and `/table/test` will match this `$.tsx` as the entry file of the route, which will ensure that the sub-application route is loaded correctly in the micro frontend scenario)
51
+
52
+ #### Load file-base routing sub-app
52
53
 
53
- #### 加载约定式路由子应用
54
54
  ```js title="src/routes/table/$.tsx"
55
55
  import { useModuleApps } from '@modern-js/plugin-garfish/runtime';
56
56
 
@@ -67,7 +67,8 @@ const Index = () => {
67
67
  export default Index;
68
68
  ```
69
69
 
70
- #### 加载自控式路由子应用
70
+ #### Load self-controlled routing sub-app
71
+
71
72
  ```js title="src/routes/dashboard/$.tsx"
72
73
  import { useModuleApps } from '@modern-js/plugin-garfish/runtime';
73
74
 
@@ -83,16 +84,18 @@ const Index = () => {
83
84
 
84
85
  export default Index;
85
86
  ```
86
- #### 路由跳转
87
- 此时主应用配置已经完成,通过路由即可加载子应用,修改主应用的 `layout.tsx` 来跳转路由
87
+ #### route link
88
+
89
+ At this time, the main application configuration has been completed, and the sub-application can be loaded through the route, and the `layout.tsx` of the main application can be modified to jump to the route:
90
+
88
91
  ```js title="src/route/layout.tsx"
89
92
  import { Outlet, Link } from '@modern-js/runtime/router';
90
93
 
91
94
  const Layout = () => (
92
95
  <div>
93
- <div><Link to={'/table'}>加载约定式路由子应用</Link></div>
94
- <div><Link to={'/dashboard'}>加载自控式路由子应用</Link></div>
95
- <div><Link to={'/'}>卸载子应用</Link></div>
96
+ <div><Link to={'/table'}>Load file-base routing sub-app</Link></div>
97
+ <div><Link to={'/dashboard'}>Load self-controlled routing sub-app</Link></div>
98
+ <div><Link to={'/'}>unmount sub-app</Link></div>
96
99
  <Outlet />
97
100
  </div>
98
101
  );
@@ -100,55 +103,51 @@ const Layout = () => (
100
103
  export default Layout;
101
104
  ```
102
105
 
103
- ### 创建自控式路由主应用
106
+ ### Self-Controlled Main App
104
107
 
105
- 通过命令行工具初始化项目:
108
+ Initialize the project with a command line:
106
109
 
107
110
  ```bash
108
111
  mkdir masterApp && cd masterApp
109
112
  npx @modern-js/create
110
113
  ```
111
114
 
112
- <DefaultMWAGenerate />
113
-
114
- 完成项目创建后我们可以通过 `pnpm run new` 来开启 `微前端` 功能:
115
+ After the project is created, we can enable the `micro frontend` function through `pnpm run new`:
115
116
 
116
117
  ```bash
117
- ? 请选择你想要的操作 启用可选功能
118
- ? 启用可选功能 启用「微前端」模式
118
+ ? Action Enable features
119
+ ? Enable features Enable Micro Front-end Feature
119
120
  ```
120
121
 
121
- 接下来,让我们注册微前端插件并添加开启微前端主应用,并增加子应用列表:
122
+ Next, let's register the micro frontend plugin and add the main micro frontend app and add the list of sub-apps:
122
123
 
123
124
  <EnableMicroFrontend />
124
125
 
125
- 由于是自控式路由,我们删除掉 `routes` 文件夹并在 `src` 目录下增加 `App.tsx` 文件,此处如果使用的 `非 MApp` 组件,需要通过 `React Router v6` `createBrowserRouter` API 来创建路由
126
- #### 加载子应用
126
+ Since it is a self-controlled route, we delete the `routes/` folder and add the `App.tsx` file in the `src/` directory. If you use a `non-MApp` component here, you need to use the `createBrowserRouter` API of '=React Router v6 to create routes.
127
+
128
+ #### Load sub-app
129
+
127
130
  import CustomRouterMicroFrontend from "@site-docs/components/custom-router-micro-frontend";
128
131
 
129
132
  <CustomRouterMicroFrontend />
130
133
 
131
- ### 创建约定式路由子应用
134
+ ### File-based sub-app
132
135
 
133
- 通过命令行工具初始化项目:
136
+ Initialize the project with a command line:
134
137
 
135
138
  ```bash
136
139
  mkdir table && cd table
137
140
  npx @modern-js/create
138
141
  ```
139
142
 
140
- 按照如下选择,生成项目:
141
-
142
- <DefaultMWAGenerate/>
143
-
144
- 我们执行 `pnpm run new` 来开启 `微前端` 功能:
143
+ After create sub-app. We execute `pnpm run new` to enable the `micro frontend` function:
145
144
 
146
145
  ```bash
147
- ? 请选择你想要的操作 启用可选功能
148
- ? 启用可选功能 启用「微前端」模式
146
+ ? Action Enable features
147
+ ? Enable features Enable Micro Front-end Feature
149
148
  ```
150
149
 
151
- 接下来,让我们注册微前端插件并修改 `modern.config.ts`,添加微前端子应用的配置 `deploy.microFrontend`:
150
+ Next, let's register the micro frontend plugin and modify `modern.config.ts` to add the configuration of the micro frontend sub-app `deploy.microFrontend`:
152
151
 
153
152
  ```js title="modern.config.ts"
154
153
  import appTools, { defineConfig } from '@modern-js/app-tools';
@@ -169,38 +168,35 @@ export default defineConfig({
169
168
  });
170
169
  ```
171
170
 
172
- 添加 `src/routes/page.tsx` 代码
171
+ add `src/routes/page.tsx`:
172
+
173
173
  ```js title="src/routes/page.tsx"
174
174
  const Index = () => {
175
175
  return (
176
- <div className="container-box">subApp: 约定式路由的子应用的根路由</div>
176
+ <div className="container-box">subApp</div>
177
177
  )
178
178
  }
179
179
 
180
180
  export default Index;
181
181
  ```
182
182
 
183
- ### 创建自控式路由子应用
183
+ ### Self-controlled sub-app
184
184
 
185
- 通过命令行工具初始化项目:
185
+ Initialize the project with a command line:
186
186
 
187
187
  ```bash
188
- mkdir dashboard && cd dashboard
188
+ mkdir table && cd table
189
189
  npx @modern-js/create
190
190
  ```
191
191
 
192
- 按照如下选择,生成项目:
193
-
194
- <DefaultMWAGenerate/>
195
-
196
- 我们执行 `pnpm run new` 来开启 `微前端`:
192
+ After create sub-app. We execute `pnpm run new` to enable the `micro frontend` function:
197
193
 
198
194
  ```bash
199
- ? 请选择你想要的操作 启用可选功能
200
- ? 启用可选功能 启用「微前端」模式
195
+ ? Action Enable features
196
+ ? Enable features Enable Micro Front-end Feature
201
197
  ```
202
198
 
203
- 接下来,让我们注册微前端插件并修改 `modern.config.ts`,添加微前端子应用的配置 `deploy.microFrontend`:
199
+ Next, let's register the micro frontend plugin and modify `modern.config.ts` to add the configuration of the micro frontend sub-app `deploy.microFrontend`:
204
200
 
205
201
  ```js title="modern.config.ts"
206
202
  import appTools, { defineConfig } from '@modern-js/app-tools';
@@ -220,9 +216,10 @@ export default defineConfig({
220
216
  plugins: [appTools(), garfishPlugin()],
221
217
  });
222
218
  ```
223
- 自控式路由需要删除掉 `routes` 文件夹并在 `src` 目录下新建 `App.tsx`
224
219
 
225
- 并在 `src/App.tsx` 添加代码,注意需要从 `props` 中解析并传递 `basename` 给 `BrowserRouter`
220
+ Self-controlled routing needs to delete the `routes/` folder and create a new `App.tsx` in the `src/` directory.
221
+
222
+ And add code in `src/App.tsx`, note that you need to parse from `props` and pass `basename` to `BrowserRouter`.
226
223
 
227
224
  ```js title="src/App.tsx"
228
225
  import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
@@ -233,24 +230,25 @@ export default (props: {basename: string}) => {
233
230
  return (
234
231
  <BrowserRouter basename={basename}>
235
232
  <Routes>
236
- <Route index element={<div>自控式路由子应用根路由</div>} />
237
- <Route path={'path'} element={<div>自控式路由子应用子路由</div>} />
233
+ <Route index element={<div>Self-controlled route root</div>} />
234
+ <Route path={'path'} element={<div>Self-controlled sub route</div>} />
238
235
  </Routes>
239
236
  </BrowserRouter>
240
237
  );
241
238
  };
242
239
  ```
243
240
 
244
- ## 调试
245
- 按顺序在目录执行 `pnpm run dev` 命令启动应用:
246
- - masterApp 主应用 `http://localhost:8080`
247
- - table 子应用(约定式路由) `http://localhost:8081`
248
- - dashboard 子应用(自控式路由) `http://localhost:8082`
241
+ ## Debug
242
+
243
+ Start the application by executing the `pnpm run dev` command in the directory in sequence:
244
+ - masterApp `http://localhost:8080`
245
+ - table subapplication (conventional routing) `http://localhost:8081`
246
+ - dashboard subapplication (self-controlled routing) `http://localhost:8082`
249
247
 
250
- 访问主应用地址 `http://localhost:8080`
248
+ Access the main application address `http://localhost:8080`
251
249
 
252
- 在完成了微前端整体开发流程的体验后,你可以进一步了解如何 [开发主应用](/guides/topic-detail/micro-frontend/c03-main-app)
250
+ After completing the experience of the overall development process of micro frontend, you can learn more about how to [develop the main application](/guides/topic-detail/micro-frontend/c03-main-app).
253
251
 
254
- ## 常见问题
252
+ ## FAQ
255
253
 
256
- 自查手册: https://www.garfishjs.org/issues/
254
+ Garfish issue: https://www.garfishjs.org/issues/