@modern-js/main-doc 2.25.0 → 2.25.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/en/apis/app/commands.mdx +2 -2
  3. package/docs/en/apis/app/hooks/config/icon.mdx +2 -2
  4. package/docs/en/apis/app/runtime/web-server/middleware.mdx +1 -1
  5. package/docs/en/components/custom-router-micro-frontend.mdx +40 -0
  6. package/docs/en/components/ua-polyfill.mdx +1 -1
  7. package/docs/en/configure/app/auto-load-plugin.mdx +1 -1
  8. package/docs/en/configure/app/bff/proxy.mdx +2 -2
  9. package/docs/en/configure/app/builder-plugins.mdx +1 -1
  10. package/docs/en/configure/app/runtime/master-app.mdx +1 -1
  11. package/docs/en/configure/app/runtime/state.mdx +1 -1
  12. package/docs/en/guides/advanced-features/bff/index.mdx +1 -0
  13. package/docs/en/guides/advanced-features/code-split.mdx +1 -1
  14. package/docs/en/guides/advanced-features/rspack-start.mdx +1 -1
  15. package/docs/en/guides/advanced-features/ssr.mdx +1 -1
  16. package/docs/en/guides/basic-features/data-fetch.mdx +1 -1
  17. package/docs/en/guides/basic-features/html.mdx +50 -33
  18. package/docs/en/guides/topic-detail/changesets/add.mdx +1 -1
  19. package/docs/en/guides/topic-detail/changesets/release-pre.mdx +1 -1
  20. package/docs/en/guides/topic-detail/changesets/release.mdx +1 -1
  21. package/docs/en/guides/topic-detail/generator/create/option.md +3 -3
  22. package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +1 -1
  23. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +2 -2
  24. package/docs/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +3 -3
  25. package/docs/en/guides/topic-detail/model/manage-effects.mdx +1 -1
  26. package/docs/en/guides/topic-detail/model/model-communicate.mdx +1 -1
  27. package/docs/en/guides/topic-detail/model/performance.mdx +1 -1
  28. package/docs/en/guides/topic-detail/model/quick-start.mdx +2 -2
  29. package/docs/en/guides/topic-detail/model/use-model.mdx +3 -3
  30. package/docs/zh/apis/monorepo/commands/deploy.mdx +1 -1
  31. package/docs/zh/configure/app/builder-plugins.mdx +4 -3
  32. package/docs/zh/guides/basic-features/html.mdx +49 -29
  33. package/docs/zh/guides/topic-detail/model/manage-effects.mdx +1 -1
  34. package/docs/zh/guides/topic-detail/model/model-communicate.mdx +1 -1
  35. package/docs/zh/guides/topic-detail/model/performance.mdx +1 -1
  36. package/docs/zh/guides/topic-detail/model/quick-start.mdx +1 -1
  37. package/docs/zh/guides/topic-detail/model/use-model.mdx +3 -3
  38. package/package.json +5 -5
  39. package/docs/zh/apis/monorepo/commands/_category_.json +0 -8
  40. package/docs/zh/apis/monorepo/commands/bump.mdx +0 -39
  41. package/docs/zh/apis/monorepo/commands/change.mdx +0 -57
  42. package/docs/zh/apis/monorepo/commands/clear.mdx +0 -24
  43. package/docs/zh/apis/monorepo/commands/gen-release-note.mdx +0 -32
  44. package/docs/zh/apis/monorepo/commands/index.mdx +0 -7
  45. package/docs/zh/apis/monorepo/commands/lint.mdx +0 -18
  46. package/docs/zh/apis/monorepo/commands/new.mdx +0 -39
  47. package/docs/zh/apis/monorepo/commands/pre.mdx +0 -65
  48. package/docs/zh/apis/monorepo/commands/release.mdx +0 -16
  49. package/docs/zh/apis/monorepo/commands/upgrade.mdx +0 -20
  50. package/docs/zh/apis/monorepo/hooks/_category_.json +0 -8
  51. package/docs/zh/apis/monorepo/hooks/apps.mdx +0 -14
  52. package/docs/zh/apis/monorepo/hooks/code-workspace.mdx +0 -11
  53. package/docs/zh/apis/monorepo/hooks/examples.mdx +0 -16
  54. package/docs/zh/apis/monorepo/hooks/features.mdx +0 -16
  55. package/docs/zh/apis/monorepo/hooks/index.mdx +0 -7
  56. package/docs/zh/apis/monorepo/hooks/packages.mdx +0 -16
  57. package/docs/zh/apis/monorepo/hooks/pnpm-workspace.mdx +0 -11
  58. package/docs/zh/apis/monorepo/hooks/pnpmfile.mdx +0 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.25.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4a83fcd: docs(main-doc): fix wrong links and add missing files
8
+ docs(main-doc): 修复错误的链接,补充缺失的文件
9
+ - @modern-js/builder-doc@2.25.2
10
+
11
+ ## 2.25.1
12
+
13
+ ### Patch Changes
14
+
15
+ - @modern-js/builder-doc@2.25.1
16
+
3
17
  ## 2.25.0
4
18
 
5
19
  ### Patch Changes
@@ -71,7 +71,7 @@ modern dev --entry foo,bar
71
71
 
72
72
  ## modern build
73
73
 
74
- The `modern build` command will build a production-ready product in the `dist/` directory by default. You can specify the output directory by modifying the configuration [`output.distPath`](/configure/app/output/dist-path).
74
+ The `modern build` command will build production-ready artifacts in the `dist/` directory by default. You can specify the output directory by modifying the configuration [`output.distPath`](/configure/app/output/dist-path).
75
75
 
76
76
  ```bash
77
77
  Usage: modern build [options]
@@ -96,7 +96,7 @@ File sizes after production build:
96
96
  645 B dist/static/css/main.0dd3ecc1.css
97
97
  ```
98
98
 
99
- Open the above HTML file in the browser, you can see the tile diagram of the packaged product, and perform package volume analysis and optimization:
99
+ Open the above HTML file in the browser, you can see the tile diagram of the bundled files, and perform package volume analysis and optimization:
100
100
 
101
101
  <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/mwa-build-analyze-8784f762c1ab0cb20935829d5f912c4c.png" />
102
102
 
@@ -7,7 +7,7 @@ sidebar_position: 2
7
7
 
8
8
  ## Favicon
9
9
 
10
- When there is a `favicon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.favicon](/configure/app/html/favicon) configuration item for generating the favicon icon on the page:
10
+ When there is a `favicon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.favicon](/configure/app/html/favicon) configuration option for generating the favicon icon on the page:
11
11
 
12
12
  ```
13
13
  ./config
@@ -32,7 +32,7 @@ When setting up the favicon, Modern.js looks for files in the following order:
32
32
 
33
33
  ## Apple Touch Icon
34
34
 
35
- When there is an `icon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.appIcon](/configure/app/html/app-icon) configuration item for generating the Apple Touch Icon icon under the iOS system.
35
+ When there is an `icon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.appIcon](/configure/app/html/app-icon) configuration option for generating the Apple Touch Icon icon under the iOS system.
36
36
 
37
37
  ```
38
38
  ./config
@@ -123,7 +123,7 @@ export const middleware: SomeType = (ctx, next) => {
123
123
  };
124
124
  ```
125
125
 
126
- By default, the framework extension capability of Web Server is turned off after installing the framework extension plug-in. If you want to use the framework extension, you can turn it on through ['server.enableFrameworkExt'](/configure/app/server/enable-framework-ext.html).
126
+ By default, the framework extension capability of Web Server is turned off after installing the framework extension plugin. If you want to use the framework extension, you can turn it on through ['server.enableFrameworkExt'](/configure/app/server/enable-framework-ext.html).
127
127
 
128
128
 
129
129
  :::info
@@ -0,0 +1,40 @@
1
+ ```js title="src/App.tsx"
2
+ import { useModuleApps } from '@modern-js/plugin-garfish/runtime';
3
+
4
+ import { RouterProvider, Route, createBrowserRouter, createRoutesFromElements, BrowserRouter, Link, Outlet } from '@modern-js/runtime/router';
5
+
6
+ const AppLayout = () => (
7
+ <>
8
+ <div><Link to={'/table'}>Loading conventional routed sub-applications</Link></div>
9
+ <div><Link to={'/dashboard'}>Loading Self-Controlled Routing Sub-Applications</Link></div>
10
+ <div><Link to={'/'}>Uninstall a sub-application</Link></div>
11
+ <Outlet />
12
+ </>
13
+ )
14
+
15
+ export default () => {
16
+ const { apps, MApp, Table, Dashboard } = useModuleApps();
17
+
18
+ // If you are not using the MApp component, you need to use createBrowserRouter to create the route.
19
+ const router = createBrowserRouter(
20
+ createRoutesFromElements(
21
+ <Route path="/" element={<AppLayout />}>
22
+ <Route key={'table'} path={'table/*'} element={<Table />} />
23
+ <Route key={'dashboard'} path={'dashboard/*'} element={<Dashboard />} />
24
+ </Route>
25
+ )
26
+ );
27
+
28
+ return (
29
+ // Approach 1: Use MApp to automatically load sub-applications based on the configured activeWhen parameter (this project is configured in modern.config.ts)
30
+ // <BrowserRouter>
31
+ // <MApp />
32
+ // </BrowserRouter>
33
+
34
+ // Approach 2: Manually write Route components to load sub-applications, which is convenient for scenarios that require authentication and other pre-requisite operations
35
+ <>
36
+ <RouterProvider router={router} />
37
+ </>
38
+ );
39
+ };
40
+ ```
@@ -23,7 +23,7 @@ export default defineConfig({
23
23
  });
24
24
  ```
25
25
 
26
- After configuring `output.polyfill` as `ua` and executing `pnpm run build & & pnpm run serve` to start the server, visiting the page can see that the HTML product contains the following script:
26
+ After configuring `output.polyfill` as `ua` and executing `pnpm run build & & pnpm run serve` to start the server, visiting the page can see that the HTML artifacts contains the following script:
27
27
 
28
28
  ```js
29
29
  <script src="/__polyfill__" crossorigin></script>
@@ -24,7 +24,7 @@ export default defineConfig({
24
24
 
25
25
  ### Auto Registration plugin
26
26
 
27
- In addition to means registration, Modern.js also provides a way to automatically register plugins: set the `autoLoadPlugin` configuration item to `true`.
27
+ In addition to means registration, Modern.js also provides a way to automatically register plugins: set the `autoLoadPlugin` configuration option to `true`.
28
28
 
29
29
  ```ts title="modern.config.ts"
30
30
  import { defineConfig } from '@modern-js/app-tools';
@@ -28,13 +28,13 @@ export default defineConfig({
28
28
 
29
29
  Assuming the address of Modern.js BFF server is `localhost:8080`, all requests starting with `api` will be proxied to `https://cnodejs.org`, for example, the request to `localhost:8080/api/v1/topics` will be proxied to `https://cnodejs.org/api/v1/topics`.
30
30
 
31
- import BFFProxyPathRewrite from "@site-docs/components/bff-proxy-path-rewrite";
31
+ import BFFProxyPathRewrite from "@site-docs-en/components/bff-proxy-path-rewrite";
32
32
 
33
33
  <BFFProxyPathRewrite />
34
34
 
35
35
  Unlike [dev.proxy](/configure/app/dev/proxy), the proxy here only applies to requests entering the BFF/API service; at the same time, this configuration can not only be used in the development environment, but also proxies corresponding requests in the production environment.
36
36
 
37
- import BFFProxyPrinciple from "@site-docs/components/bff-proxy-principle";
37
+ import BFFProxyPrinciple from "@site-docs-en/components/bff-proxy-principle";
38
38
 
39
39
  <BFFProxyPrinciple />
40
40
 
@@ -53,7 +53,7 @@ export default defineConfig({
53
53
  });
54
54
  ```
55
55
 
56
- ### Plugin configuration items
56
+ ### Plugin configuration options
57
57
 
58
58
  If the plugin provides some custom configuration options, you can pass in the configuration through the parameters of the plugin function.
59
59
 
@@ -37,4 +37,4 @@ interface AppInfo {
37
37
 
38
38
  In the `masterApp` configuration, developers can pass through options supported by Garfish
39
39
 
40
- All supported configuration items [see here](https://garfishjs.org/api/run/#%E5%8F%82%E6%95%B0).
40
+ All supported configuration options [see here](https://garfishjs.org/api/run/#%E5%8F%82%E6%95%B0).
@@ -9,7 +9,7 @@ sidebar_label: state
9
9
 
10
10
  Once `state` is enabled, you can use [Model](/guides/topic-detail/model/quick-start) for state management.
11
11
 
12
- The specific configuration items are as follows:
12
+ The specific configuration options are as follows:
13
13
 
14
14
  ## models
15
15
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: BFF
3
3
  ---
4
+
4
5
  # BFF
5
6
 
6
7
  In the development of the concept of **front back separation**, the front-end part can do more and more things, and the front-end needs some UI-oriented data interfaces, so the industry introduced the concept of BFF (Backends for Frontends).
@@ -16,7 +16,7 @@ When using Modern.js [Conventional routing](/guides/basic-features/routes#conven
16
16
 
17
17
  ## import
18
18
 
19
- use dynamic `import()`, the JS modules pass to this API will be packaged as a separate JS file, for example:
19
+ use dynamic `import()`, the JS modules pass to this API will be bundled as a separate JS file, for example:
20
20
 
21
21
  ```ts
22
22
  import('./math').then(math => {
@@ -92,4 +92,4 @@ Usually it is available and any errors that arise will fixed promptly.
92
92
  However, if there are any break changes that require modern.js to modify the code, we recommend to wait for the next version of modern.js.
93
93
  :::
94
94
 
95
- More examples of using package management tools, please refer to: [Lock nested dependency](/guides/get-started/upgrade.html#lock-nested-dependency).
95
+ More examples of using package managers, please refer to: [Lock nested dependency](/guides/get-started/upgrade.html#lock-nested-dependency).
@@ -251,7 +251,7 @@ if (process.env.MODERN_TARGET === 'browser') {
251
251
  }
252
252
  ```
253
253
 
254
- After the development environment is packaged, the SSR and CSR products will be compiled into the following content. Therefore, there will be no more Web API errors in the SSR environment.
254
+ After the development environment is bundled, the SSR and CSR artifacts will be compiled into the following content. Therefore, there will be no more Web API errors in the SSR environment.
255
255
 
256
256
  ```ts
257
257
  // SSR production
@@ -336,7 +336,7 @@ export default async (): Promise<ProfileData> => {
336
336
  };
337
337
  ```
338
338
 
339
- 4. When running on the server, the `loader` function will be packaged into a unified bundle, so we do not recommend using `__filename` and `__dirname` in server-side code.
339
+ 4. When running on the server, the `loader` function will be bundled into a unified bundle, so we do not recommend using `__filename` and `__dirname` in server-side code.
340
340
 
341
341
  ### FAQ
342
342
 
@@ -2,6 +2,7 @@
2
2
  title: HTML Template
3
3
  sidebar_position: 9
4
4
  ---
5
+
5
6
  # HTML Template
6
7
 
7
8
  Modern.js provides **JSX syntax** and **HTML(EJS) syntax** to customize the HTML template.
@@ -44,7 +45,7 @@ import { Html, Body, Root, Head, Scripts } from '@modern-js/runtime/document';
44
45
 
45
46
  - `Head`: provide the ability of native Head Element and automatically fills in `<meta>` and `<Scripts>` components.
46
47
 
47
- - `Scripts`: provide the ability to adjust the position of script tags injected into the HTML during the build process. By default, it is placed in the `<Head>` component.
48
+ - `Scripts`: Used to control the placement of the `<script>` tags generated by the build. By default, they are placed within the `<Head>` component.
48
49
 
49
50
  - `Comment`: retain user-written comments like `<!-- gateway -->` and outputs them to the rendered HTML.
50
51
 
@@ -59,7 +60,7 @@ Modern.js also provides `DocumentContext` to provide some configuration and envi
59
60
  - `entryName`: the current entry name.
60
61
  - `templateParams`: parameters of HTML template (compatible with traditional templates, so it's not recommended for use).
61
62
 
62
- ### Example
63
+ ### Basic Example
63
64
 
64
65
  ```tsx
65
66
  import React, { useContext } from 'react';
@@ -68,8 +69,8 @@ import {
68
69
  Root,
69
70
  Head,
70
71
  Body,
71
- DocumentContext,
72
72
  Comment,
73
+ DocumentContext,
73
74
  } from '@modern-js/runtime/document';
74
75
 
75
76
  export default function Document(): React.ReactElement {
@@ -89,9 +90,9 @@ export default function Document(): React.ReactElement {
89
90
  <Body>
90
91
  <Root rootId="root">
91
92
  <h1 style={{ color: 'red' }}>Some Params: </h1>
92
- <h2> entryName:{entryName}</h2>
93
- <h2> title:{htmlConfig.title}</h2>
94
- <h2> rootId: {templateParams.mountId}</h2>
93
+ <h2>entryName: {entryName}</h2>
94
+ <h2>title: {htmlConfig.title}</h2>
95
+ <h2>rootId: {templateParams.mountId}</h2>
95
96
  </Root>
96
97
  <h1>bottom</h1>
97
98
  </Body>
@@ -105,46 +106,62 @@ The above JSX components will generate the following HTML template:
105
106
  ```html
106
107
  <!DOCTYPE html>
107
108
  <html>
108
-
109
- <head>
110
- <meta charset="utf-8">
111
- <meta name="viewport"
112
- content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
113
- <meta http-equiv="x-ua-compatible" content="ie=edge">
114
- <meta name="renderer" content="webkit">
115
- <meta name="layoutmode" content="standard">
116
- <meta name="imagemode" content="force">
117
- <meta name="wap-font-scale" content="no">
118
- <meta name="format-detection" content="telephone=no">
119
- <link rel="icon" href="/a.icon">
109
+ <head>
110
+ <meta charset="utf-8" />
111
+ <meta
112
+ name="viewport"
113
+ content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
114
+ />
115
+ <meta http-equiv="x-ua-compatible" content="ie=edge" />
116
+ <meta name="renderer" content="webkit" />
117
+ <meta name="layoutmode" content="standard" />
118
+ <meta name="imagemode" content="force" />
119
+ <meta name="wap-font-scale" content="no" />
120
+ <meta name="format-detection" content="telephone=no" />
121
+ <link rel="icon" href="/a.icon" />
120
122
  <script defer src="/static/js/builder-runtime.js"></script>
121
123
  <script defer src="/static/js/lib-react.js"></script>
122
124
  <script defer src="/static/js/lib-polyfill.js"></script>
123
125
  <script defer src="/static/js/lib-router.js"></script>
124
-
125
- <script>
126
- ...
127
- </script>
128
- <script defer src="/static/js/sub.js"></script>
126
+ <script defer src="/static/js/main.js"></script>
129
127
  <link href="https://modernjs.dev" />
130
128
  <!-- Need a Comment -->
131
- </head>
129
+ </head>
132
130
 
133
- <body>
131
+ <body>
134
132
  <div id="root">
135
- <!--<?- html ?>-->
136
- <h1 style="color:red">Some Params: </h1>
137
- <h2> entryName:sub</h2>
138
- <h2> title:</h2>
139
- <h2> rootId: root</h2>
133
+ <!--<?- html ?>-->
134
+ <h1 style="color:red">Some Params:</h1>
135
+ <h2>entryName: main</h2>
136
+ <h2>title:</h2>
137
+ <h2>rootId: root</h2>
140
138
  </div>
141
139
  <h1>bottom</h1>
142
140
  <!--<?- chunksMap.js ?>-->
143
141
  <!--<?- SSRDataScript ?>-->
144
- </body>
145
-
142
+ </body>
146
143
  </html>
144
+ ```
145
+
146
+ ### Scripts Component Example
147
147
 
148
+ You can use the `<Scripts>` component to insert the `<script>` tags generated by the build inside the `<body>` tag:
149
+
150
+ ```tsx
151
+ import React from 'react';
152
+ import { Html, Root, Head, Body, Scripts } from '@modern-js/runtime/document';
153
+
154
+ export default function Document(): React.ReactElement {
155
+ return (
156
+ <Html>
157
+ <Head></Head>
158
+ <Body>
159
+ <Root rootId="root"></Root>
160
+ <Scripts />
161
+ </Body>
162
+ </Html>
163
+ );
164
+ }
148
165
  ```
149
166
 
150
167
  ## HTML Syntax
@@ -164,7 +181,7 @@ Under the application root directory, create the `config/html/` directory, which
164
181
 
165
182
  **These fragments will be injected into the default HTML template according to their positions.**
166
183
 
167
- ```html
184
+ ```xml
168
185
  <!DOCTYPE html>
169
186
  <html>
170
187
  <head>
@@ -19,7 +19,7 @@ A changeset includes:
19
19
  ## Steps
20
20
 
21
21
  :::info
22
- The following example commands are all using pnpm. If you need to use other package management tools, please replace them as needed.
22
+ The following example commands are all using pnpm. If you need to use other package managers, please replace them as needed.
23
23
  :::
24
24
 
25
25
  ### NPM Module
@@ -9,7 +9,7 @@ Before doing an actual release, we also need to publish a pre-release version fo
9
9
  ## Steps
10
10
 
11
11
  :::info
12
- The following example commands are all using pnpm. If you need to use other package management tools, please replace them as needed.
12
+ The following example commands are all using pnpm. If you need to use other package managers, please replace them as needed.
13
13
  :::
14
14
 
15
15
  #### Run the bump command to upgrade the version of the pre-release
@@ -9,7 +9,7 @@ When releasing a version, we need to upgrade the version of the corresponding pa
9
9
  ## Steps
10
10
 
11
11
  :::info
12
- The following example commands are all using pnpm. If you need to use other package management tools, please replace them as needed.
12
+ The following example commands are all using pnpm. If you need to use other package managers, please replace them as needed.
13
13
 
14
14
  :::
15
15
 
@@ -65,9 +65,9 @@ By default, `@modern-js/create` will automatically identify the user's system la
65
65
 
66
66
  Specify the default project configuration.
67
67
 
68
- By default, `@modern-js/create` will prompt for interactive questions such as language selection and package management tools during the execution process. When it is necessary to specify these configuration contents in advance, they can be passed in through this field.
68
+ By default, `@modern-js/create` will prompt for interactive questions such as language selection and package managers during the execution process. When it is necessary to specify these configuration contents in advance, they can be passed in through this field.
69
69
 
70
- This field is a JSON string. For example, when specifying a package management tool:
70
+ This field is a JSON string. For example, when specifying a package manager:
71
71
 
72
72
  ```bash
73
73
  npx @modern-js/create@latest --config '{"packageManager": "pnpm"}'
@@ -122,7 +122,7 @@ npx @modern-js/create@next --dist-tag next
122
122
 
123
123
  Specify specific package version dependencies when creating a project.
124
124
 
125
- If you need to specify a specific package version when creating a project, you can use this parameter. This parameter will configure `pnpm.overrides` (if the package management tool is pnpm) or `resolutions` to lock the package version number in the `package.json` file in the project root directory.
125
+ If you need to specify a specific package version when creating a project, you can use this parameter. This parameter will configure `pnpm.overrides` (if the package manager is pnpm) or `resolutions` to lock the package version number in the `package.json` file in the project root directory.
126
126
 
127
127
  The parameter value is a JSON string.
128
128
 
@@ -46,4 +46,4 @@ Parameters:
46
46
 
47
47
  ### install
48
48
 
49
- Installs dependencies in the root directory of the project. The `install` function will use the corresponding package management tool according to the value of `packageManager` to install dependencies.
49
+ Installs dependencies in the root directory of the project. The `install` function will use the corresponding package manager according to the value of `packageManager` to install dependencies.
@@ -39,7 +39,7 @@ After the project is created, we can enable the `micro frontend` through `pnpm r
39
39
 
40
40
  Next, let's register the micro frontend plugin and add the main micro frontend app and add the list of sub-apps:
41
41
 
42
- import EnableMicroFrontend from "@site-docs/components/enable-micro-frontend";
42
+ import EnableMicroFrontend from "@site-docs-en/components/enable-micro-frontend";
43
43
 
44
44
  <EnableMicroFrontend />
45
45
 
@@ -127,7 +127,7 @@ Since it is a self-controlled route, we delete the `routes/` folder and add the
127
127
 
128
128
  #### Load sub-app
129
129
 
130
- import CustomRouterMicroFrontend from "@site-docs/components/custom-router-micro-frontend";
130
+ import CustomRouterMicroFrontend from "@site-docs-en/components/custom-router-micro-frontend";
131
131
 
132
132
  <CustomRouterMicroFrontend />
133
133
 
@@ -8,7 +8,7 @@ In the previous [Experience micro frontend](/guides/topic-detail/micro-frontend/
8
8
 
9
9
  After creating an application project through the `@modern-js/create` command, you can execute `pnpm run new` in the project (the `modern new` command is actually executed). After selecting the 「micro frontend」 mode, the micro frontend will be installed. Dependencies, just register the plugin manually.
10
10
 
11
- import EnableMicroFrontend from "@site-docs/components/enable-micro-frontend";
11
+ import EnableMicroFrontend from "@site-docs-en/components/enable-micro-frontend";
12
12
 
13
13
  <EnableMicroFrontend />
14
14
 
@@ -23,10 +23,10 @@ You can register the sub-application information directly through the configurat
23
23
  :::tip
24
24
  It can be configured at runtime via the API [defineConfig](/apis/app/runtime/app/define-config).
25
25
 
26
- When the parameter is a function, it cannot be serialized to the product code, so please configure it through defineConfig when it comes to configuration such as functions
26
+ When the parameter is a function, it cannot be serialized to the output code, so please configure it through defineConfig when it comes to configuration such as functions
27
27
  :::
28
28
 
29
- import MicroRuntimeConfig from "@site-docs/components/micro-runtime-config";
29
+ import MicroRuntimeConfig from "@site-docs-en/components/micro-runtime-config";
30
30
 
31
31
  <MicroRuntimeConfig />
32
32
 
@@ -248,5 +248,5 @@ const handleClick = async () => {
248
248
  ```
249
249
 
250
250
  :::info
251
- [Example](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/effects)
251
+ [Example](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/effects)
252
252
  :::
@@ -100,7 +100,7 @@ The final effect is as follows:
100
100
  ![communicate-models](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/docs/models-communicate.gif)
101
101
 
102
102
  :::info Additional Information
103
- - Full example code for this section can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/models-communication).
103
+ - Full example code for this section can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/models-communication).
104
104
  - For more information about the relevant API, please refer to: [model](/apis/app/runtime/model/model_#function-types).
105
105
 
106
106
  :::
@@ -165,6 +165,6 @@ const barModel = model("bar").define({
165
165
  We created a caching function `createSelector`, which only recalculates the value of `combineA` when the state of `barModel` changes or the state `a` of `fooModel` changes.
166
166
 
167
167
  :::info Additional Information
168
- You can find the complete example code of this section [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/performance-optimization).
168
+ You can find the complete example code of this section [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/performance-optimization).
169
169
  :::
170
170
 
@@ -4,7 +4,7 @@ title: Quick Start
4
4
  ---
5
5
  # Quick Start
6
6
 
7
- import ReduckMigration from "@site-docs/components/reduck-migration"
7
+ import ReduckMigration from "@site-docs-en/components/reduck-migration"
8
8
 
9
9
  <ReduckMigration />
10
10
 
@@ -110,5 +110,5 @@ The final demonstration effect is as follows:
110
110
 
111
111
  ![countModel](https://lf3-static.bytednsdoc.com/obj/eden-cn/eueh7vhojuh/modern/simple-count-model.gif)
112
112
 
113
- That completes a simple counter application. You can view the complete example code for this section [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/counter-model).
113
+ That completes a simple counter application. You can view the complete example code for this section [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/counter-model).
114
114
 
@@ -163,7 +163,7 @@ function ThreeComponent() {
163
163
 
164
164
  Using React's refs can also achieve similar effects. In fact, `useStaticModel` also uses refs internally. However, using `useStaticModel` directly helps decouple the state management logic from the component and converge it into the Model layer.
165
165
 
166
- The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/static-model).
166
+ The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/static-model).
167
167
 
168
168
  ### Using as Local State
169
169
 
@@ -194,7 +194,7 @@ Click the `add` button of `Counter` and `LocalCounter` respectively, and the sta
194
194
 
195
195
  ![local-model](https://lf3-static.bytednsdoc.com/obj/eden-cn/eueh7vhojuh/modern/local-model.gif)
196
196
 
197
- The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/local-model).
197
+ The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/local-model).
198
198
 
199
199
  ## Using outside of components
200
200
 
@@ -237,7 +237,7 @@ setInterval(() => {
237
237
  }, 1000);
238
238
  ```
239
239
 
240
- The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/series/tutorials/runtime-api/model/counter-model-outof-react).
240
+ The complete sample code can be found [here](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/runtime-api/counter-model-outof-react).
241
241
 
242
242
  :::info
243
243
  If the Store object is manually created through [`createStore`](/apis/app/runtime/model/create-store), there is no need to obtain it through `useStore` in the component, and it can be used directly.
@@ -9,7 +9,7 @@ Usage: modern deploy [options]
9
9
  deploy project
10
10
 
11
11
  Options:
12
- -p, --path [path] Specify the path of the product output (default: "output")
12
+ -p, --path [path] Specify the path of the output files (default: "output")
13
13
  -h, --help display help for command
14
14
  ```
15
15
 
@@ -2,6 +2,7 @@
2
2
  title: builderPlugins (构建插件)
3
3
  sidebar_position: 10
4
4
  ---
5
+
5
6
  # builderPlugins (构建插件)
6
7
 
7
8
  - **类型:** `BuilderPlugin[]`
@@ -36,7 +37,7 @@ Modern.js Builder 是 Modern.js 底层的构建引擎,请阅读 [构建能力]
36
37
  使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。
37
38
 
38
39
  ```ts title="modern.config.ts"
39
- import myBuilderPlugin from 'my-builder-plugin';
40
+ import { myBuilderPlugin } from 'my-builder-plugin';
40
41
 
41
42
  export default defineConfig({
42
43
  builderPlugins: [myBuilderPlugin()],
@@ -48,7 +49,7 @@ export default defineConfig({
48
49
  使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。
49
50
 
50
51
  ```ts title="modern.config.ts"
51
- import myBuilderPlugin from './plugin/myBuilderPlugin';
52
+ import { myBuilderPlugin } from './plugin/myBuilderPlugin';
52
53
 
53
54
  export default defineConfig({
54
55
  builderPlugins: [myBuilderPlugin()],
@@ -60,7 +61,7 @@ export default defineConfig({
60
61
  如果插件提供了一些自定义的配置项,可以通过插件函数的参数传入配置。
61
62
 
62
63
  ```ts title="modern.config.ts"
63
- import myBuilderPlugin from 'my-builder-plugin';
64
+ import { myBuilderPlugin } from 'my-builder-plugin';
64
65
 
65
66
  export default defineConfig({
66
67
  builderPlugins: [