@modern-js/main-doc 2.35.0 → 2.35.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/docs/en/apis/app/commands.mdx +12 -11
  2. package/docs/en/components/debug-app.mdx +1 -3
  3. package/docs/en/components/global-proxy-config.mdx +4 -13
  4. package/docs/en/components/global-proxy.mdx +2 -4
  5. package/docs/en/components/init-app.mdx +1 -1
  6. package/docs/en/configure/app/builder-plugins.mdx +2 -2
  7. package/docs/en/configure/app/plugins.mdx +3 -4
  8. package/docs/en/configure/app/server/base-url.mdx +0 -2
  9. package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
  10. package/docs/en/guides/basic-features/alias.mdx +1 -1
  11. package/docs/en/guides/basic-features/css.mdx +35 -15
  12. package/docs/en/guides/basic-features/data-fetch.mdx +12 -12
  13. package/docs/en/guides/basic-features/html.mdx +2 -2
  14. package/docs/en/guides/basic-features/routes.mdx +27 -15
  15. package/docs/en/guides/get-started/quick-start.mdx +8 -17
  16. package/docs/en/guides/get-started/upgrade.mdx +10 -4
  17. package/docs/en/guides/topic-detail/framework-plugin/implement.mdx +2 -0
  18. package/docs/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +1 -0
  19. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +24 -17
  20. package/docs/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +51 -37
  21. package/docs/en/guides/topic-detail/micro-frontend/c04-communicate.mdx +1 -0
  22. package/docs/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +1 -1
  23. package/docs/en/tutorials/first-app/c02-component.mdx +4 -3
  24. package/docs/zh/apis/app/commands.mdx +10 -9
  25. package/docs/zh/apis/app/hooks/api/api.mdx +2 -1
  26. package/docs/zh/apis/app/hooks/server/index_.mdx +2 -1
  27. package/docs/zh/components/debug-app.mdx +1 -3
  28. package/docs/zh/components/global-proxy-config.mdx +4 -13
  29. package/docs/zh/components/global-proxy.mdx +2 -4
  30. package/docs/zh/configure/app/builder-plugins.mdx +1 -1
  31. package/docs/zh/configure/app/plugins.mdx +1 -2
  32. package/docs/zh/configure/app/server/base-url.mdx +0 -2
  33. package/docs/zh/configure/app/source/enable-async-entry.mdx +1 -1
  34. package/docs/zh/guides/basic-features/alias.mdx +1 -1
  35. package/docs/zh/guides/basic-features/css.mdx +35 -15
  36. package/docs/zh/guides/basic-features/data-fetch.mdx +11 -12
  37. package/docs/zh/guides/basic-features/html.mdx +4 -5
  38. package/docs/zh/guides/basic-features/routes.mdx +26 -19
  39. package/docs/zh/guides/get-started/quick-start.mdx +8 -17
  40. package/docs/zh/guides/get-started/upgrade.mdx +10 -4
  41. package/docs/zh/guides/topic-detail/framework-plugin/hook-list.mdx +1 -1
  42. package/docs/zh/guides/topic-detail/framework-plugin/implement.mdx +2 -0
  43. package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +45 -21
  44. package/docs/zh/guides/topic-detail/micro-frontend/c03-main-app.mdx +51 -33
  45. package/docs/zh/guides/topic-detail/micro-frontend/c04-communicate.mdx +1 -0
  46. package/docs/zh/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +1 -0
  47. package/docs/zh/tutorials/first-app/c02-component.mdx +4 -3
  48. package/package.json +7 -7
@@ -30,7 +30,6 @@ After running `modern dev`, Modern.js will watch source file changes and apply h
30
30
  $ modern dev
31
31
 
32
32
  info Starting dev server...
33
- info App running at:
34
33
 
35
34
  > Local: http://localhost:8080/
36
35
  > Network: http://192.168.0.1:8080/
@@ -42,7 +41,7 @@ In multi-page (MPA) projects, the `--entry` option can be added to specify one o
42
41
 
43
42
  For example, execute `modern dev --entry`, the entry selector will be displayed in the command line interface:
44
43
 
45
- ```bash
44
+ ```text
46
45
  $ modern dev --entry
47
46
 
48
47
  ? Please select the entry that needs to be built
@@ -86,14 +85,16 @@ Options:
86
85
 
87
86
  execute `npx modern build --analyze` command, can produce an HTML file that analyzes the volume of the bundle while packaging the production code:
88
87
 
89
- ```
88
+ ```text
90
89
  Bundle Analyzer saved report to /example/dist/report.html
91
- File sizes after production build:
92
90
 
93
- 122.35 KB dist/static/js/885.1d4fbe5a.js
94
- 2.3 KB dist/static/js/main.4b8e8d64.js
95
- 761 B dist/static/js/runtime-main.edb7cf35.js
96
- 645 B dist/static/css/main.0dd3ecc1.css
91
+ info Production file sizes:
92
+
93
+ File Size Gzipped
94
+ dist/static/js/lib-react.09721b5c.js 152.6 kB 49.0 kB
95
+ dist/html/main/index.html 5.8 kB 2.5 kB
96
+ dist/static/js/main.3568a38e.js 3.5 kB 1.4 kB
97
+ dist/static/css/main.03221f72.css 1.4 kB 741 B
97
98
  ```
98
99
 
99
100
  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:
@@ -125,7 +126,7 @@ Options:
125
126
 
126
127
  In the project, execute the `new` command to add entries as follows:
127
128
 
128
- ```bash
129
+ ```text
129
130
  $ npx modern new
130
131
  ? Please select the operation you want: Create Element
131
132
  ? Please select the type of element to create: New "entry"
@@ -136,7 +137,7 @@ $ npx modern new
136
137
 
137
138
  In the project, execute the `new` command to enable features as follows:
138
139
 
139
- ```bash
140
+ ```text
140
141
  $ npx modern new
141
142
  ? Please select the operation you want: Enable Features
142
143
  ? Please select the feature name: (Use arrow keys)
@@ -156,7 +157,7 @@ pnpm does not support the use of JSON strings as parameter values currently. Use
156
157
 
157
158
  ## modern serve
158
159
 
159
- Usually use the `modern serve` command to enable project run in the production environment, and you need to execute the [`build'](/apis/app/commands#modern-build) command in advance to build the outputs.
160
+ The `modern serve` command is used to start a Modern.js project in the production environment. It can also be used to preview the artifacts built for the production environment locally. Please note that you need to execute the [`build`](/apis/app/commands#modern-build) command beforehand to generate the corresponding artifacts.
160
161
 
161
162
  ```bash
162
163
  Usage: modern serve [options]
@@ -6,12 +6,10 @@ $ pnpm run dev
6
6
  > modern dev
7
7
 
8
8
  info Starting dev server...
9
- info App running at:
9
+ ready Client compiled in 50ms
10
10
 
11
11
  > Local: http://localhost:8080/
12
12
  > Network: http://192.168.0.1:8080/
13
-
14
- Client ✔ done in 76.10ms
15
13
  ```
16
14
 
17
15
  Open `http://localhost:8000/` in your browser to see the page content.
@@ -7,16 +7,9 @@ This option is used to configure a global proxy based on [whistle](https://wprox
7
7
 
8
8
  Before using this option, you need to install and register the `@modern-js/plugin-proxy` plugin:
9
9
 
10
- ```bash
11
- # npm
12
- npm add @modern-js/plugin-proxy -D
13
-
14
- # yarn
15
- yarn add @modern-js/plugin-proxy -D
10
+ import { PackageManagerTabs } from '@theme';
16
11
 
17
- # pnpm
18
- pnpm add @modern-js/plugin-proxy -D
19
- ```
12
+ <PackageManagerTabs command="add @modern-js/plugin-proxy -D" />
20
13
 
21
14
  After the installation, please register the plugin in the `modern.config.ts` file:
22
15
 
@@ -75,13 +68,11 @@ module.exports = {
75
68
  Execute `dev`, when the prompt is as follows, the proxy server starts successfully:
76
69
 
77
70
  ```bash
78
- App running at:
79
-
80
71
  Local: http://localhost:8080/
81
72
  Network: http://192.168.0.1:8080/
82
73
 
83
- info Starting the proxy server.....
84
- success Proxy Server start on localhost:8899
74
+ info Starting proxy server.....
75
+ success Proxy server start on localhost:8899
85
76
  ```
86
77
 
87
78
  Access the `localhost:8899` to view the Network and configure proxy rules on the UI interface:
@@ -11,13 +11,11 @@ Specific proxy rules can be set via the [`dev.proxy`](/configure/app/dev/proxy)
11
11
  After installing the proxy plugin and configuring the proxy rules, run the `pnpm run dev` command:
12
12
 
13
13
  ```bash
14
- App running at:
15
-
16
14
  Local: http://localhost:8080/
17
15
  Network: http://192.168.0.1:8080/
18
16
 
19
- info Starting the proxy server.....
20
- success Proxy Server start on localhost:8899
17
+ info Starting proxy server.....
18
+ success Proxy server start on localhost:8899
21
19
  ```
22
20
 
23
21
  You can see that the proxy server has started successfully in the console.
@@ -14,7 +14,7 @@ After create the project, Modern.js will automatically install dependencies and
14
14
  [INFO] git repository has been automatically created
15
15
  [INFO] Success!
16
16
  You can run the following command in the directory of the new project:
17
- pnpm run dev # Starting the dev server
17
+ pnpm run dev # Starting dev server
18
18
  pnpm run build # Build the app for production
19
19
  pnpm run serve # Preview the production build locally
20
20
  pnpm run lint # Run ESLint and automatically fix problems
@@ -15,8 +15,8 @@ Modern.js Builder is the build tool of Modern.js, please read [Builder](/guides/
15
15
 
16
16
  This option **is used to configure the Modern.js Builder plugins**. If you need to configure other types of plugins, please select the corresponding configs:
17
17
 
18
- - Use [plugins](/configure/app/builder-plugins) to configure Modern.js framework plugins.
19
- - Use [tools.webpack](/configure/app/tools/webpack) or [tools.webpackChain](/configure/app/tools/webpack-chain) to configure webpack plugins.
18
+ - Use [plugins](/configure/app/plugins) to configure Modern.js framework plugins.
19
+ - Use [tools.bundlerChain](/configure/app/tools/bundler-chain) to configure Rspack or webpack plugins.
20
20
  - Use [tools.babel](/configure/app/tools/babel) to configure Babel plugins.
21
21
 
22
22
  ## When to use
@@ -15,10 +15,9 @@ Refer to [How to Develop Plugins](/guides/topic-detail/framework-plugin/implemen
15
15
 
16
16
  This option is used to configure framework plugins. If you need to configure other types of plugins, please choose the corresponding configuration method:
17
17
 
18
- - To configure Modern.js Builder plugins, use the [builderPlugins](/configure/app/builder-plugins) option.
19
- - To configure webpack plugins, use the [tools.webpack](/configure/app/tools/webpack)、[tools.webpackChain](/configure/app/tools/webpack-chain) or [tools.bundlerChain](/configure/app/tools/bundler-chain) options.
20
- - To configure Rspack plugins, use the [tools.rspack](/configure/app/tools/rspack) or [tools.bundlerChain](/configure/app/tools/bundler-chain) options.
21
- - To configure Babel plugins, use the [tools.babel](/configure/app/tools/babel) option.
18
+ - Use [builderPlugins](/configure/app/builder-plugins) to configure Modern.js Builder plugins.
19
+ - Use [tools.bundlerChain](/configure/app/tools/bundler-chain) to configure Rspack or webpack plugins.
20
+ - Use [tools.babel](/configure/app/tools/babel) to configure Babel plugins.
22
21
 
23
22
  ## Plugin types
24
23
 
@@ -25,8 +25,6 @@ export default defineConfig({
25
25
  After running `dev`, you will see that the route access will have the corresponding prefix added:
26
26
 
27
27
  ```bash
28
- App running at:
29
-
30
28
  > Local: http://localhost:8080/base/
31
29
  > Network: http://192.168.0.1:8080/base/
32
30
  ```
@@ -49,6 +49,6 @@ import('./bootstrap.jsx');
49
49
  At this point, you can consume any remote module in the current page.
50
50
 
51
51
  :::info
52
- Modern.js does not have webpack's ModuleFederationPlugin plugin built in. Please configure the ModuleFederationPlugin yourself via [tools.webpackChain](/configure/app/tools/webpack-chain).
52
+ Modern.js does not have ModuleFederationPlugin plugin built in. Please configure the ModuleFederationPlugin yourself via [tools.bundlerChain](/configure/app/tools/bundler-chain).
53
53
 
54
54
  :::
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 3
2
+ sidebar_position: 4
3
3
  ---
4
4
 
5
5
  # Path Alias
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 2
2
+ sidebar_position: 1
3
3
  ---
4
4
 
5
5
  # Styling
@@ -61,16 +61,31 @@ If you need to use other CSS-in-JS libraries such as [styled-jsx](https://www.np
61
61
 
62
62
  ## Using Tailwind CSS
63
63
 
64
- [Tailwind CSS](https://tailwindcss.com/) is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles. To use [Tailwind CSS](https://tailwindcss.com/) in Modern.js, simply run `pnpm run new` in the project root directory and enable it.
64
+ [Tailwind CSS](https://tailwindcss.com/) is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles.
65
65
 
66
- Follow the steps below to make a selection:
66
+ To use [Tailwind CSS](https://tailwindcss.com/) in Modern.js, you can follow the steps below:
67
+
68
+ 1. Run `pnpm run new` in the root directory of your project and make the following selections:
67
69
 
68
70
  ```text
69
71
  ? Please select the operation you want: Enable features
70
72
  ? Please select the feature name: Enable Tailwind CSS
71
73
  ```
72
74
 
73
- Register the Tailwind plugin in `modern.config.ts`:
75
+ After successful initialization, you will see the following additions to the `package.json` file:
76
+
77
+ ```json title="./package.json"
78
+ {
79
+ "dependencies": {
80
+ "tailwindcss": "^3.0.0"
81
+ },
82
+ "devDependencies": {
83
+ "@modern-js/plugin-tailwindcss": "^2.0.0"
84
+ }
85
+ }
86
+ ```
87
+
88
+ 2. Register the Tailwind plugin in `modern.config.ts`:
74
89
 
75
90
  ```ts title="modern.config.ts"
76
91
  import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';
@@ -80,29 +95,34 @@ export default defineConfig({
80
95
  });
81
96
  ```
82
97
 
83
- To use, add the following code to the root component (such as `src/App.jsx`) of the entry:
98
+ 3. Create a `index.css` file and add the following code:
99
+
100
+ ```css title="index.css"
101
+ @tailwind base;
102
+ @tailwind components;
103
+ @tailwind utilities;
104
+ ```
105
+
106
+ :::info
107
+ Depending on your needs, you can selectively import the CSS styles provided by Tailwind CSS. Please refer to the [`@tailwind` documentation](https://tailwindcss.com/docs/functions-and-directives#tailwind) for detailed usage of the `@tailwind` directive.
108
+ :::
109
+
110
+ 4. Import the `index.css` file, for example, add the following code in the root component `src/App.jsx`:
84
111
 
85
112
  ```js
86
- import 'tailwindcss/base.css';
87
- import 'tailwindcss/components.css';
88
- import 'tailwindcss/utilities.css';
113
+ import './index.css';
89
114
  ```
90
115
 
91
- Then you can use the Utility Class provided by Tailwind CSS in each component:
116
+ 5. Now you can use the Utility Classes provided by Tailwind CSS in your components:
92
117
 
93
118
  ```tsx
94
- const App = () => (
119
+ const Hello = () => (
95
120
  <div className="h-12 w-48">
96
121
  <p className="text-xl font-medium text-black">hello world</p>
97
122
  </div>
98
123
  );
99
124
  ```
100
125
 
101
- :::info Additional Information
102
- Depending on your needs, you can selectively import the CSS files provided by Tailwind CSS. Since using `@tailwind` is equivalent to directly importing CSS files, you can refer to the comments in the [`@tailwind` usage](https://tailwindcss.com/docs/functions-and-directives#tailwind) documentation for the purpose of the CSS files provided by Tailwind CSS.
103
-
104
- :::
105
-
106
126
  ### Configuring Tailwind CSS
107
127
 
108
128
  In Modern.js, you have two ways to configure Tailwind CSS:
@@ -1,10 +1,11 @@
1
1
  ---
2
- sidebar_position: 4
2
+ title: Data Fetching
3
+ sidebar_position: 3
3
4
  ---
4
5
 
5
6
  # Data Fetching
6
7
 
7
- Modern.js provides out-of-the-box data fetching capabilities, allowing developers to develop in an isomorphic way in both client-side and server-side code.
8
+ Modern.js provides out-of-the-box data fetching capabilities,developers can fetch data in the project through these APIs.
8
9
 
9
10
  It should be noted that these APIs do not help applications initiate requests, but rather help developers better manage data and improve project performance.
10
11
 
@@ -13,7 +14,7 @@ It should be noted that these APIs do not help applications initiate requests, b
13
14
  Modern.js recommends using [conventional routing](/guides/basic-features/routes) for routing management. Through Modern.js's [conventional (nested) routing](/guides/basic-features/routes#conventional-routing), each routing component (`layout.ts` or `page.ts`) can have a same-named `loader` file. The `loader` file needs to export a function that will be executed before the component is rendered to provide data for the routing component.
14
15
 
15
16
  :::info
16
- Modern.js v1 supports fetching data via [useLoader](/guides/basic-features/data-fetch.html#useloader-(old-version)), which is no longer the recommended usage. We do not recommend mixing the two except during the migration process.
17
+ Modern.js v1 supports fetching data via [useLoader](</guides/basic-features/data-fetch.html#useloader-(old-version)>), which is no longer the recommended usage. We do not recommend mixing the two except during the migration process.
17
18
 
18
19
  :::
19
20
 
@@ -216,25 +217,24 @@ If you want to get the data returned by the `loader` in `entry1/routes/layout.ts
216
217
 
217
218
  :::info
218
219
  This feature is currently experimental and the API may change in the future.
219
- Currently only supports CSR, please look forward to Streaming SSR.
220
220
  :::
221
221
 
222
222
  Create `user/layout.loader.ts` and add the following code:
223
223
 
224
224
  ```ts title="routes/user/layout.loader.ts"
225
- import { defer } from "@modern-js/runtime/router"
225
+ import { defer } from '@modern-js/runtime/router';
226
226
 
227
227
  const loader = () =>
228
- defer({
229
- userInfo: new Promise((resolve) => {
228
+ defer({
229
+ userInfo: new Promise(resolve => {
230
230
  setTimeout(() => {
231
231
  resolve({
232
232
  age: 1,
233
- name: 'user layout'
234
- })
235
- }, 1000)
236
- })
237
- })
233
+ name: 'user layout',
234
+ });
235
+ }, 1000);
236
+ }),
237
+ });
238
238
 
239
239
  export default loader;
240
240
  ```
@@ -165,9 +165,9 @@ export default function Document(): React.ReactElement {
165
165
 
166
166
  ## HTML Syntax
167
167
 
168
- Modern.js also supports HTML syntax. By default, Modern.js application projects will include a built-in HTML template for generating HTML code.
168
+ Modern.js also supports generating HTML files using HTML (EJS) syntax.
169
169
 
170
- Based on the HTML syntax template, Modern.js provides two ways to customize the template: **custom HTML fragments** and **custom the whole HTML**.
170
+ By default, Modern.js projects come with a built-in HTML template for generating HTML code. If you need to customize the HTML template, you can use two methods: **Custom HTML Fragments** and **Fully Custom HTML Templates**.
171
171
 
172
172
  ### Custom HTML Fragments
173
173
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 1
2
+ sidebar_position: 2
3
3
  ---
4
4
 
5
5
  # Routing
@@ -140,6 +140,7 @@ To simplify the introduction of the relationship between `<Layout>` and `<Outlet
140
140
  </UserLayout>
141
141
  </Layout>
142
142
  ```
143
+
143
144
  In summary, if there is a `layout.tsx` file under the sub-route's file directory, the `<Outlet>` in the parent `layout.tsx` will represent the `layout.tsx` in the sub-route file directory. Otherwise, it will represent the `page.tsx` in the sub-route file directory.
144
145
 
145
146
  #### Page
@@ -148,12 +149,12 @@ All routes should end with the `<Page>` component. If the developer introduces t
148
149
 
149
150
  #### Config
150
151
 
151
- Each `Layout` or `Page` file can define its own `config` file, such as `page.config.ts`. In this file, we have an conventinal on a named export called `handle`, which you can define any properties:
152
+ Each `Layout`,`$` or `Page` file can define its own `config` file, such as `page.config.ts`. In this file, we have an conventinal on a named export called `handle`, which you can define any properties:
152
153
 
153
154
  ```ts title="routes/blog/page.config.ts"
154
155
  export const handle = {
155
- breadcrumbName: 'profile'
156
- }
156
+ breadcrumbName: 'profile',
157
+ };
157
158
  ```
158
159
 
159
160
  These properties as defined are available via the [`useMatches`](https://reactrouter.com/en/main/hooks/use-matches) hook:
@@ -161,12 +162,11 @@ These properties as defined are available via the [`useMatches`](https://reactro
161
162
  ```ts title="routes/layout.ts"
162
163
  export default () => {
163
164
  const matches = useMatches;
164
- const breadcrumbs = matches.map(matchedRoute => matchedRoute?.handle?.breadcrumbName);
165
- return (
166
- <Breadcrumb names={breadcrumbs}>
167
- </Breadcrumb>
168
- )
169
- }
165
+ const breadcrumbs = matches.map(
166
+ matchedRoute => matchedRoute?.handle?.breadcrumbName,
167
+ );
168
+ return <Breadcrumb names={breadcrumbs}></Breadcrumb>;
169
+ };
170
170
  ```
171
171
 
172
172
  ### Dynamic Routing
@@ -227,6 +227,7 @@ For example, the following directory structure:
227
227
  ```
228
228
 
229
229
  When accessing any path that does not match(For example `/blog/a`), the `routes/$.tsx` component will be rendered, because there is `layout.tsx` here, the rendered UI is as follows.
230
+
230
231
  ```tsx
231
232
  <RootLayout>
232
233
  <BlogLayout>
@@ -364,6 +365,17 @@ export default () => {
364
365
  };
365
366
  ```
366
367
 
368
+ If you want to redirect in a component,you can navigate by `useNavigate` hook, for example:
369
+
370
+ ```ts title="routes/user/page.ts"
371
+ import { useNavigate } from '@modern-js/runtime/router';
372
+
373
+ export default () => {
374
+ const navigate = useNavigate();
375
+ navigate('/login');
376
+ };
377
+ ```
378
+
367
379
  ### ErrorBoundary
368
380
 
369
381
  In each directory under `routes/`, developers can also define an `error.tsx` file that exports an `<ErrorBoundary>` component by default.
@@ -391,7 +403,6 @@ export const ErrorBoundary = () => {
391
403
 
392
404
  In each root `Layout` component (`routes/layout.ts`), you can dynamically define runtime configuration:
393
405
 
394
-
395
406
  ```tsx title="src/routes/layout.tsx"
396
407
  // Define runtime config
397
408
  import type { AppConfig } from '@modern-js/runtime';
@@ -489,6 +500,7 @@ To further improve the user experience and reduce loading time, Modern.js suppor
489
500
  ```
490
501
 
491
502
  :::info
503
+
492
504
  - This feature is currently only supported in Webpack projects and not yet supported in Rspack projects.
493
505
  - Preloading data currently only preloads the data returned by the [Data Loader](/guides/basic-features/data-fetch) in SSR projects.
494
506
 
@@ -508,13 +520,13 @@ The `prefetch` attribute has three optional values:
508
520
  - By using `render`, static assets will only be loaded when the system is idle, and will not compete with the static assets of the initial screen for network assets.
509
521
  - In the SSR scenario, data will also be pre-fetched.
510
522
 
511
- import Motivation from '@site-docs-en/components/convention-routing-motivation'
523
+ import Motivation from '@site-docs-en/components/convention-routing-motivation';
512
524
 
513
- <Motivation/>
525
+ <Motivation />
514
526
 
515
- import Practice from '@site-docs-en/components/routes-practice'
527
+ import Practice from '@site-docs-en/components/routes-practice';
516
528
 
517
- <Practice/>
529
+ <Practice />
518
530
 
519
531
  ## Self-controlled Routing
520
532
 
@@ -91,23 +91,15 @@ $ pnpm run build
91
91
 
92
92
  > modern build
93
93
 
94
- info Create a production build...
95
-
96
- info File sizes after production build:
94
+ info Staring production build...
95
+ ready Client compiled in 50ms
96
+ info Production file sizes:
97
97
 
98
98
  File Size Gzipped
99
- dist/static/js/lib-corejs.ffeb7fb8.js 214.96 kB 67.23 kB
100
- dist/static/js/lib-react.09721b5c.js 152.61 kB 49.02 kB
101
- dist/static/js/218.102e2f39.js 85.45 kB 28.5 kB
102
- dist/static/js/lib-babel.a7bba875.js 11.93 kB 3.95 kB
103
- dist/html/main/index.html 5.84 kB 2.57 kB
104
- dist/static/js/main.3568a38e.js 3.57 kB 1.44 kB
105
- dist/static/css/async/304.c3c481a5.css 2.62 kB 874 B
106
- dist/asset-manifest.json 1.48 kB 349 B
107
- dist/static/js/async/304.c45706bc.js 1.4 kB 575 B
108
- dist/static/js/async/509.fcb06e14.js 283 B 230 B
109
-
110
- Client ✔ done in 3.57s
99
+ dist/static/js/lib-react.09721b5c.js 152.6 kB 49.0 kB
100
+ dist/html/main/index.html 5.8 kB 2.5 kB
101
+ dist/static/js/main.3568a38e.js 3.5 kB 1.4 kB
102
+ dist/static/css/main.03221f72.css 1.4 kB 741 B
111
103
  ```
112
104
 
113
105
  By default, the build artifacts are generated in `dist/`, with the following directory structure:
@@ -135,8 +127,7 @@ $ pnpm run serve
135
127
 
136
128
  > modern serve
137
129
 
138
- Starting the modern server...
139
- info App running at:
130
+ info Starting production server...
140
131
 
141
132
  > Local: http://localhost:8080/
142
133
  > Network: http://192.168.0.1:8080/
@@ -8,11 +8,13 @@ sidebar_position: 3
8
8
 
9
9
  Modern.js provides the `upgrade` command to support upgrading the project to the latest version of Modern.js.
10
10
 
11
- Run `pnpm run upgrade` in the project:
11
+ Run the `upgrade` script in the project:
12
12
 
13
- ```bash
14
- $ pnpm run upgrade
13
+ import { PackageManagerTabs } from '@theme';
14
+
15
+ <PackageManagerTabs command="run upgrade" />
15
16
 
17
+ ```bash
16
18
  > modern upgrade
17
19
 
18
20
  [INFO] [Project Type]: Web App
@@ -22,11 +24,15 @@ $ pnpm run upgrade
22
24
 
23
25
  You can see that the dependencies in the project's `package.json` have been updated to the latest version.
24
26
 
27
+ :::tip
28
+ If the `upgrade` command is not declared in the project's `package.json`, you can execute `npx modern upgrade` as an equivalent alternative.
29
+ :::
30
+
25
31
  ## Upgrade to a specified version
26
32
 
27
33
  All packages of Modern.js are currently released with a **uniform version number**.
28
34
 
29
- import ReleaseNote from "@site-docs-en/components/release-note"
35
+ import ReleaseNote from '@site-docs-en/components/release-note';
30
36
 
31
37
  <ReleaseNote />
32
38
 
@@ -170,6 +170,8 @@ export const myPlugin = (): CliPlugin => ({
170
170
  });
171
171
  ```
172
172
 
173
+ Note that the setup function of the next plugin is not executed until the async setup function of the current plugin has finished. Therefore, you should avoid performing time-consuming asynchronous operations in the setup function to avoid slowing down the startup performance of the CLI.
174
+
173
175
  ## Adding Plugins
174
176
 
175
177
  Custom plugins can be used by following the instructions in the [plugins](/configure/app/plugins) section of the documentation. Below is the recommended way to implement plugins in Modern.js.
@@ -2,6 +2,7 @@
2
2
  sidebar_position: 1
3
3
  title: Introduction
4
4
  ---
5
+
5
6
  # Introduction
6
7
 
7
8
  import MicroFrontend from '@modern-js/builder-doc/docs/en/shared/micro-frontend.md';