@modern-js/main-doc 2.58.2 → 2.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. package/docs/en/apis/app/runtime/core/use-loader.mdx +1 -1
  2. package/docs/en/community/blog/_meta.json +1 -6
  3. package/docs/en/components/deploy.mdx +1 -1
  4. package/docs/en/components/init-app.mdx +0 -1
  5. package/docs/en/components/init-rspack-app.mdx +0 -1
  6. package/docs/en/components/ssr-monitor.mdx +3 -0
  7. package/docs/en/configure/_meta.json +1 -1
  8. package/docs/en/configure/app/output/ssg.mdx +52 -141
  9. package/docs/en/configure/app/tools/swc.mdx +1 -1
  10. package/docs/en/configure/app/tools/tailwindcss.mdx +1 -1
  11. package/docs/en/guides/advanced-features/_meta.json +0 -8
  12. package/docs/en/guides/advanced-features/bff/_meta.json +1 -6
  13. package/docs/en/guides/advanced-features/rsbuild-plugin.mdx +2 -2
  14. package/docs/en/guides/advanced-features/rspack-start.mdx +7 -22
  15. package/docs/en/guides/basic-features/_meta.json +31 -9
  16. package/docs/en/guides/basic-features/css/_meta.json +1 -0
  17. package/docs/en/guides/basic-features/css/css-in-js.mdx +34 -0
  18. package/docs/en/guides/basic-features/{css-modules.mdx → css/css-modules.mdx} +0 -4
  19. package/docs/en/guides/basic-features/css/css.mdx +25 -0
  20. package/docs/en/guides/basic-features/{css.mdx → css/tailwindcss.mdx} +5 -66
  21. package/docs/en/guides/basic-features/data/_meta.json +1 -4
  22. package/docs/en/guides/basic-features/data/data-fetch.mdx +134 -235
  23. package/docs/en/guides/basic-features/data/data-write.mdx +66 -77
  24. package/docs/en/guides/basic-features/debug/_meta.json +1 -0
  25. package/docs/en/guides/basic-features/debug/rsdoctor.mdx +57 -0
  26. package/docs/en/guides/{advanced-features → basic-features/debug}/using-storybook.mdx +2 -0
  27. package/docs/en/guides/basic-features/render/_meta.json +1 -0
  28. package/docs/en/guides/basic-features/render/ssg.mdx +208 -0
  29. package/docs/en/guides/{advanced-features/ssr/cache.mdx → basic-features/render/ssr-cache.mdx} +38 -50
  30. package/docs/en/guides/basic-features/render/ssr.mdx +301 -0
  31. package/docs/en/guides/basic-features/render/streaming-ssr.mdx +230 -0
  32. package/docs/en/guides/basic-features/routes.mdx +275 -263
  33. package/docs/en/guides/basic-features/static-assets/_meta.json +1 -0
  34. package/docs/en/guides/basic-features/static-assets.mdx +1 -1
  35. package/docs/en/guides/basic-features/testing/_meta.json +1 -0
  36. package/docs/en/guides/basic-features/testing/cypress.mdx +95 -0
  37. package/docs/en/guides/basic-features/testing/jest.mdx +148 -0
  38. package/docs/en/guides/basic-features/testing/playwright.mdx +111 -0
  39. package/docs/en/guides/basic-features/testing/vitest.mdx +100 -0
  40. package/docs/en/guides/concept/_meta.json +1 -4
  41. package/docs/en/guides/concept/entries.mdx +78 -47
  42. package/docs/en/guides/get-started/_meta.json +1 -7
  43. package/docs/en/guides/get-started/introduction.mdx +1 -1
  44. package/docs/en/guides/get-started/quick-start.mdx +1 -2
  45. package/docs/en/guides/get-started/tech-stack.mdx +4 -6
  46. package/docs/en/guides/get-started/upgrade.mdx +16 -2
  47. package/docs/en/guides/topic-detail/framework-plugin/_meta.json +1 -1
  48. package/docs/en/guides/topic-detail/generator/_meta.json +1 -1
  49. package/docs/en/guides/topic-detail/generator/create/_meta.json +1 -5
  50. package/docs/en/guides/topic-detail/generator/create/config.mdx +0 -10
  51. package/docs/en/guides/topic-detail/generator/create/use.mdx +0 -1
  52. package/docs/en/guides/topic-detail/generator/new/_meta.json +1 -5
  53. package/docs/en/guides/topic-detail/generator/plugin/_meta.json +1 -1
  54. package/docs/en/guides/troubleshooting/_meta.json +1 -6
  55. package/docs/en/tutorials/first-app/c03-css.mdx +1 -1
  56. package/docs/zh/apis/app/runtime/core/use-loader.mdx +1 -1
  57. package/docs/zh/community/blog/_meta.json +1 -6
  58. package/docs/zh/components/deploy.mdx +1 -1
  59. package/docs/zh/components/init-app.mdx +0 -1
  60. package/docs/zh/components/init-rspack-app.mdx +0 -1
  61. package/docs/zh/components/ssr-monitor.mdx +3 -0
  62. package/docs/zh/configure/_meta.json +1 -1
  63. package/docs/zh/configure/app/output/ssg.mdx +49 -139
  64. package/docs/zh/configure/app/tools/swc.mdx +1 -1
  65. package/docs/zh/configure/app/tools/tailwindcss.mdx +1 -1
  66. package/docs/zh/guides/advanced-features/_meta.json +0 -8
  67. package/docs/zh/guides/advanced-features/bff/_meta.json +1 -6
  68. package/docs/zh/guides/advanced-features/rsbuild-plugin.mdx +2 -2
  69. package/docs/zh/guides/advanced-features/rspack-start.mdx +8 -24
  70. package/docs/zh/guides/basic-features/_meta.json +31 -9
  71. package/docs/zh/guides/basic-features/css/_meta.json +1 -0
  72. package/docs/zh/guides/basic-features/css/css-in-js.mdx +34 -0
  73. package/docs/zh/guides/basic-features/css/css.mdx +25 -0
  74. package/docs/zh/guides/basic-features/{css.mdx → css/tailwindcss.mdx} +3 -64
  75. package/docs/zh/guides/basic-features/data/_meta.json +1 -4
  76. package/docs/zh/guides/basic-features/data/data-fetch.mdx +98 -214
  77. package/docs/zh/guides/basic-features/data/data-write.mdx +54 -55
  78. package/docs/zh/guides/basic-features/debug/_meta.json +1 -0
  79. package/docs/zh/guides/basic-features/debug/rsdoctor.mdx +57 -0
  80. package/docs/zh/guides/{advanced-features → basic-features/debug}/using-storybook.mdx +1 -1
  81. package/docs/zh/guides/basic-features/render/_meta.json +1 -0
  82. package/docs/zh/guides/basic-features/render/ssg.mdx +210 -0
  83. package/docs/zh/guides/{advanced-features/ssr/cache.mdx → basic-features/render/ssr-cache.mdx} +16 -26
  84. package/docs/zh/guides/basic-features/render/ssr.mdx +309 -0
  85. package/docs/zh/guides/{advanced-features/ssr/stream.mdx → basic-features/render/streaming-ssr.mdx} +22 -37
  86. package/docs/zh/guides/basic-features/routes.mdx +252 -237
  87. package/docs/zh/guides/basic-features/static-assets/_meta.json +1 -0
  88. package/docs/zh/guides/basic-features/static-assets.mdx +2 -6
  89. package/docs/zh/guides/basic-features/testing/_meta.json +1 -0
  90. package/docs/zh/guides/basic-features/testing/cypress.mdx +95 -0
  91. package/docs/zh/guides/basic-features/testing/jest.mdx +148 -0
  92. package/docs/zh/guides/basic-features/testing/playwright.mdx +112 -0
  93. package/docs/zh/guides/basic-features/testing/vitest.mdx +100 -0
  94. package/docs/zh/guides/concept/_meta.json +1 -4
  95. package/docs/zh/guides/concept/entries.mdx +80 -58
  96. package/docs/zh/guides/get-started/_meta.json +1 -7
  97. package/docs/zh/guides/get-started/introduction.mdx +2 -2
  98. package/docs/zh/guides/get-started/quick-start.mdx +1 -2
  99. package/docs/zh/guides/get-started/tech-stack.mdx +8 -10
  100. package/docs/zh/guides/get-started/upgrade.mdx +15 -1
  101. package/docs/zh/guides/topic-detail/framework-plugin/_meta.json +1 -1
  102. package/docs/zh/guides/topic-detail/generator/_meta.json +1 -1
  103. package/docs/zh/guides/topic-detail/generator/create/_meta.json +1 -5
  104. package/docs/zh/guides/topic-detail/generator/create/config.mdx +0 -10
  105. package/docs/zh/guides/topic-detail/generator/create/use.mdx +0 -1
  106. package/docs/zh/guides/topic-detail/generator/new/_meta.json +1 -5
  107. package/docs/zh/guides/topic-detail/generator/plugin/_meta.json +1 -1
  108. package/docs/zh/guides/troubleshooting/_meta.json +1 -6
  109. package/docs/zh/tutorials/first-app/c03-css.mdx +1 -1
  110. package/i18n.json +16 -4
  111. package/package.json +6 -6
  112. package/rspress.config.ts +1 -1
  113. package/src/components/ContentCard/index.tsx +1 -1
  114. package/src/components/Sandpack/index.tsx +1 -1
  115. package/src/components/ShowcaseList/index.tsx +1 -1
  116. package/src/i18n/index.ts +1 -1
  117. package/src/pages/index.tsx +2 -2
  118. package/docs/en/apis/app/hooks/config/storybook.mdx +0 -37
  119. package/docs/en/guides/advanced-features/ssg.mdx +0 -116
  120. package/docs/en/guides/advanced-features/ssr/_meta.json +0 -5
  121. package/docs/en/guides/advanced-features/ssr/index.mdx +0 -23
  122. package/docs/en/guides/advanced-features/ssr/stream.mdx +0 -248
  123. package/docs/en/guides/advanced-features/ssr/usage.mdx +0 -341
  124. package/docs/en/guides/advanced-features/ssr.mdx +0 -555
  125. package/docs/zh/apis/app/hooks/config/storybook.mdx +0 -38
  126. package/docs/zh/guides/advanced-features/ssg.mdx +0 -116
  127. package/docs/zh/guides/advanced-features/ssr/_meta.json +0 -5
  128. package/docs/zh/guides/advanced-features/ssr/index.mdx +0 -23
  129. package/docs/zh/guides/advanced-features/ssr/usage.mdx +0 -329
  130. /package/docs/en/guides/basic-features/{mock.mdx → debug/mock.mdx} +0 -0
  131. /package/docs/en/guides/basic-features/{proxy.mdx → debug/proxy.mdx} +0 -0
  132. /package/docs/en/guides/basic-features/{json-files.mdx → static-assets/json-files.mdx} +0 -0
  133. /package/docs/en/guides/basic-features/{svg-assets.mdx → static-assets/svg-assets.mdx} +0 -0
  134. /package/docs/en/guides/basic-features/{wasm-assets.mdx → static-assets/wasm-assets.mdx} +0 -0
  135. /package/docs/zh/guides/basic-features/{css-modules.mdx → css/css-modules.mdx} +0 -0
  136. /package/docs/zh/guides/basic-features/{mock.mdx → debug/mock.mdx} +0 -0
  137. /package/docs/zh/guides/basic-features/{proxy.mdx → debug/proxy.mdx} +0 -0
  138. /package/docs/zh/guides/basic-features/{json-files.mdx → static-assets/json-files.mdx} +0 -0
  139. /package/docs/zh/guides/basic-features/{svg-assets.mdx → static-assets/svg-assets.mdx} +0 -0
  140. /package/docs/zh/guides/basic-features/{wasm-assets.mdx → static-assets/wasm-assets.mdx} +0 -0
@@ -16,7 +16,7 @@ Many configuration options provided by Modern.js are divided by entry, such as p
16
16
 
17
17
  ## Single Entry and Multiple Entries
18
18
 
19
- The project initialized by Modern.js is a single entry (SPA) project, with the following structure:
19
+ The project initialized by Modern.js is a single entry project, with the following structure:
20
20
 
21
21
  ```
22
22
  .
@@ -56,13 +56,12 @@ After running the command, Modern.js will automatically generate a new entry dir
56
56
 
57
57
  The original entry code has been moved to a directory with the same name as the `name` field in `package.json`, and a `new-entry` entry directory has been created.
58
58
 
59
- You can run `pnpm run dev` to start the development server. At this point, you will see a new route named `/new-entry` added, and the existing page routes remain unchanged.
60
-
61
- :::tip
62
59
  Modern.js will use the entry with the same name as the `name` field in `package.json` as the main entry. The route of the main entry is `/`, and the route of other entries is `/{entryName}`.
63
60
 
64
- For example, when the `name` field in `package.json` is `myapp`, `src/myapp` will be the main entry of the project.
61
+ You can run `pnpm run dev` to start the development server. At this point, you will see a new route named `/new-entry` added, and the existing page routes remain unchanged.
65
62
 
63
+ :::note
64
+ The concepts of **single entry/multiple entry** and **SPA/MPA** are not equivalent. The former pertains to how to configure and package the application, while the latter is about the patterns for organizing front-end applications. Each entry point can be either an SPA or a non-SPA.
66
65
  :::
67
66
 
68
67
  ## Entry Types
@@ -82,30 +81,26 @@ By default, Modern.js scans the files under `src/` before starting the project,
82
81
 
83
82
  :::
84
83
 
85
- Not all top-level directories under `src/` become project entries. The directory where the entry is located must meet one of the following five conditions:
84
+ The entry directory must meet one of the following three conditions:
86
85
 
87
86
  1. Has a `routes/` directory.
88
87
  2. Has an `App.[jt]sx?` file.
89
- 3. Has an `index.[jt]sx?` file.
90
- 4. Has a `pages/` directory (compatible with Modern.js 1.0).
91
- 5. Has an `entry.[jt]sx?` file.
88
+ 5. Has an `entry.[jt]sx?` file.(Requires [source.enableCustomEntry](/configure/app/source/enable-custom-entry) to be enabled)
92
89
 
93
- When the `src/` directory meets the entry requirements, Modern.js considers the current project as a single entry application.
90
+ When the `src/` directory meets the conditions of an entry, Modern.js will consider the current application to be a single-entry application. Otherwise, Modern.js will scan the first-level directories under `src/` and further determine if they are entries. In this case, the application is typically a multi-entry application.
94
91
 
95
92
  :::tip
96
93
  In a single entry application, the default entry name is `main`.
97
94
 
98
95
  :::
99
96
 
100
- When the project is not a single entry application, Modern.js will further look at the top-level directories under `src/`.
101
-
102
97
  ### Framework Mode Entry
103
98
 
104
- The framework mode refers to the need to use the framework capabilities of Modern.js, such as nested routing, SSR, and integrated BFF, etc. Under this kind of entry convention, the entry defined by the developer is not the actual compilation entry. When Modern.js is launched, it generates a wrapped entry, and the real entry can be found at `node_modules/.modern/[entryName]/index.js`.
99
+ Framework mode refers to using Modern.js's framework capabilities, such as convention routing, SSR (Server-Side Rendering), and integrated calls. Under this type of entry convention, the entries in the application are not the actual compilation entries. Modern.js will generate a wrapped entry during startup, which you can find in `node_modules/.modern/[entryName]/index.js`.
105
100
 
106
101
  #### Conventional Routing
107
102
 
108
- If there is a `routes/` directory in the entry, Modern.js will scan the files under `routes/` during startup, and automatically generate client-side routes (react-router) based on file conventions. For example:
103
+ If there is a `routes/` directory within the entry, we refer to this entry as a convention-based route. Modern.js will scan the files under `routes/` during startup and automatically generate client-side routes (react-router) based on file conventions. For example:
109
104
 
110
105
  ```bash
111
106
  .
@@ -121,7 +116,19 @@ For more information, please refer to [Conventional Routing](/guides/basic-featu
121
116
 
122
117
  #### Self-controlled Routing
123
118
 
124
- If there is an `App.[jt]sx?` file in the entry, developers can set the client-side route in this file through code, or not set the client-side route.
119
+ ## Manual Routing
120
+
121
+ If there is an `App.[jt]sx?` file within the entry, we refer to this entry as a self-controlled route. For example:
122
+
123
+ ```bash
124
+ .
125
+ ├── src
126
+ │ └── App.tsx
127
+ ```
128
+
129
+ For entry points defined as `src/App.tsx`, Modern.js does not perform any additional routing operations. Developers can use the [React Router 6](https://reactrouter.com/en/main) API for development, define client-side routes or not to set any client-side routes.
130
+
131
+ for example, define client-side routes in application:
125
132
 
126
133
  ```tsx
127
134
  import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
@@ -138,16 +145,21 @@ export default () => {
138
145
  };
139
146
  ```
140
147
 
141
- For more information, please refer to [Self-controlled Routing](/guides/basic-features/routes.html#self-controlled-routing).
148
+ :::note
149
+ We recommend that developers use conventional routing. Modern.js provides a series of optimizations in resource loading and rendering for conventional routing by default and offers built-in SSR capabilities. When using manual routing, these capabilities need to be encapsulated by developers themselves.
150
+ :::
142
151
 
143
- #### Custom Entry
144
152
 
145
- If there is an `entry.[jt]sx` file in the entry, developers need to call the `createRoot` and `render` functions in the `entry.[jt]sx` file to complete the project's entry logic.
153
+ #### Custom Entry
146
154
 
147
155
  :::info
148
- Using this file requires enabling [source.enableCustomEntry](/configure/app/source/enable-custom-entry).
156
+ Using this features requires enabling [source.enableCustomEntry](/configure/app/source/enable-custom-entry).
149
157
  :::
150
158
 
159
+ By default, whether you use convention routing or self-controlled routing, Modern.js will automatically handle rendering. If you wish to customize this behavior, you can creating a custom entry file.
160
+
161
+ If there is an `entry.[jt]sx` file within the entry, Modern.js will no longer control the application's rendering process. You can call the `createRoot` and `render` functions within the `entry.[jt]sx` file to complete the entry logic for your application.
162
+
151
163
  ```tsx
152
164
  import { createRoot } from '@modern-js/runtime/react';
153
165
  import { render } from '@modern-js/runtime/browser';
@@ -157,7 +169,9 @@ const ModernRoot = createRoot();
157
169
  render(<ModernRoot />);
158
170
  ```
159
171
 
160
- For example, if some other operations need to be performed before render is executed, it can be implemented in this way:
172
+ In the code above, the component returned by the `createRoot` function is either the component generated from the `routes/` directory or the component exported by `App.tsx`.
173
+
174
+ The `render` function is used to handle rendering and mounting of the component. For example, if you want to execute some asynchronous tasks before rendering, you can achieve it like this:
161
175
 
162
176
  ```tsx
163
177
  import { createRoot } from '@modern-js/runtime/react';
@@ -166,7 +180,7 @@ import { render } from '@modern-js/runtime/browser';
166
180
  const ModernRoot = createRoot();
167
181
 
168
182
  async function beforeRender() {
169
- // todo
183
+ // some async request
170
184
  }
171
185
 
172
186
  beforeRender().then(() => {
@@ -174,34 +188,15 @@ beforeRender().then(() => {
174
188
  });
175
189
  ```
176
190
 
177
- #### Custom Bootstrap
178
-
179
- :::warning
180
- Soon to be deprecated, it is recommended to use a custom entry.
181
- :::
182
-
183
- If there is an `index.[jt]sx` file in the entry, and the file exports a function by default, Modern.js will pass the default `bootstrap` function as a parameter and use the exported function to replace the default `bootstrap`. This way, developers can customize how components are mounted to DOM nodes or add custom behavior before mounting. For example:
184
-
185
- ```tsx
186
- export default (App: React.ComponentType, bootstrap: () => void) => {
187
- // do something before bootstrap...
188
- initSomething().then(() => {
189
- bootstrap();
190
- });
191
- };
192
- ```
193
-
194
191
  ### Build Mode Entry
195
192
 
196
- Build mode refers to not using the Runtime capabilities provided by Modern.js, but rather having the developer define the entry of the page completely on their own.
197
-
198
- When the entry directory contains `index.[jt]sx` (soon to be deprecated) and does not export a function via `export default`, or when there is an `entry.[jt]sx` file in the entry directory and the `@modern-js/runtime` dependency is not installed, the corresponding file will be identified as the entry module of webpack or Rspack.
199
-
200
193
  :::info
201
- Using the `entry.[jt]sx` file requires enabling [source.enableCustomEntry](/configure/app/source/enable-custom-entry).
194
+ Using this features requires enabling [source.enableCustomEntry](/configure/app/source/enable-custom-entry).
202
195
  :::
203
196
 
204
- In this case, Modern.js will not generate the entry code automatically. Therefore, you need to manually mount the component to the DOM node, for example:
197
+ Build mode refers to the development mode that does not use Modern.js's runtime capabilities and only utilizes Modern.js's build capabilities. When the `@modern-js/runtime` dependency is not installed in the application, Modern.js will treat all entries as build mode entries.
198
+
199
+ In this case, if there is an `entry.[jt]sx` file within the entry, this file will be recognized as the build entry for webpack or Rspack. Modern.js will not automatically generate entry code at this time, and you need to mount the component to the DOM node yourself. For example:
205
200
 
206
201
  ```js title=src/entry.tsx
207
202
  import React from 'react';
@@ -211,9 +206,13 @@ import App from './App';
211
206
  ReactDOM.render(<App />, document.getElementById('root'));
212
207
  ```
213
208
 
214
- This approach is equivalent to enabling the [source.entries.disableMount](/configure/app/source/entries) option in Modern.js. When you use this approach, **you will not be able to use the runtime capabilities of the Modern.js framework**, such as the `runtime` configuration in the `modern.config.js` file will no longer take effect.
209
+ In build mode, the application **will not be able to use Modern.js's runtime capabilities**, such as:
210
+ - Convention routing, the routing based on the files under `src/routes`
211
+ - Server-Side Rendering (SSR)
212
+ - The `runtime` configuration in the `modern.config.js` file will no longer take effect
213
+
215
214
 
216
- ## Custom Entries Config
215
+ ## Specify entry in the configuration file
217
216
 
218
217
  In some cases, you may need to customize the entry configuration instead of using the entry conventions provided by Modern.js.
219
218
 
@@ -246,4 +245,36 @@ export default defineConfig({
246
245
  });
247
246
  ```
248
247
 
249
- Note that when you enable `disableMount`, **you won't be able to use the runtime capabilities of the Modern.js framework**, such as the `runtime` configuration in the `modern.config.ts` file.
248
+ It is worth noting that, by default, Modern.js considers entries specified through the configuration as **framework mode entries** and will automatically generate the actual compilation entry.
249
+
250
+ If your application is migrating from build tools like Webpack or Vite to the Modern.js framework, you typically need to enable the `disableMount` option in the entry configuration. In this case, Modern.js will treat the entry as a **build mode entry**.
251
+
252
+ ## Deprecated
253
+
254
+ Currently, if the entry directory meets the following conditions, it will also be considered an application entry:
255
+
256
+ 1. Has an `index.[jt]sx?` file.
257
+ 2. Has a `pages/` directory.
258
+
259
+ The `pages/` directory was the convention routing in older versions of Modern.js. Now, it is recommended to use the `routes/` directory.
260
+
261
+ The `index.[jt]sx?` file supported **Custom Bootstrap** and **Build Mode Entry** in older versions. Now, it is recommended to use `entry.[jt]sx?` instead.
262
+
263
+ ### Custom Bootstrap
264
+
265
+ When there is an `index.[jt]sx` file in the entry, and the file's default export is a function, Modern.js will pass the default `bootstrap` function as an argument and use the exported function to replace the default `bootstrap`.
266
+
267
+ This allows developers to customize mounting components to DOM or add custom behaviors before mounting. For example:
268
+
269
+ ```tsx
270
+ export default (App: React.ComponentType, bootstrap: () => void) => {
271
+ // do something before bootstrap...
272
+ initSomething().then(() => {
273
+ bootstrap();
274
+ });
275
+ };
276
+ ```
277
+
278
+ ### Build Mode Entry
279
+
280
+ When an `index.[jt]sx` file exists in the entry directory and does not export a function via export default, this entry will also be considered a build mode entry.
@@ -1,7 +1 @@
1
- [
2
- "introduction",
3
- "quick-start",
4
- "upgrade",
5
- "glossary",
6
- "tech-stack"
7
- ]
1
+ ["introduction", "quick-start", "upgrade", "glossary", "tech-stack"]
@@ -55,7 +55,7 @@ It mainly includes the following features:
55
55
  - 🏠 **Integration**: Development and production environment web server are unique, CSR and SSR are isomorphic development, and API service calls are functions as interfaces.
56
56
  - 📦 **Out Of The Box**: Default TS support, built-in build, ESLint, debugging tools, fully functional and testable.
57
57
  - 🌏 **Ecology**: Self-developed state management, micro-frontend, module packaging, and other peripheral needs.
58
- - 🕸 **Routing Modes**: Includes self-controlled routing, file-convention-based routing (nested routing), etc.
58
+ - 🕸 **Convention Routing**: Using file-based routing helps developers quickly set up applications.
59
59
 
60
60
  ## Comparison with Others
61
61
 
@@ -57,7 +57,7 @@ export default defineConfig({
57
57
  ssr: true,
58
58
  },
59
59
  plugins: [appTools({
60
- bundler: 'webpack', // Set to 'experimental-rspack' to enable rspack ⚡️🦀
60
+ bundler: 'rspack', // Set to 'webpack' to enable webpack
61
61
  }),],
62
62
  });
63
63
  ```
@@ -72,7 +72,6 @@ In a newly created project, the `@modern-js/app-tools` npm package is installed
72
72
  - It integrates Modern.js Core, providing capabilities for configuration parsing, plugin loading, and more.
73
73
  - It integrates Modern.js Builder, providing build capabilities.
74
74
  - It integrates Modern.js Server, providing capabilities for development and production servers.
75
- - It integrates some commonly used plugins, such as `plugin-lint`, `plugin-data-loader`, and more.
76
75
 
77
76
  `@modern-js/app-tools` is implemented based on the plugin system of Modern.js. Essentially, it is a plugin. Therefore, you need to register `appTools` in the `plugins` field of the configuration file:
78
77
 
@@ -30,8 +30,6 @@ We are also working with Zack Jackson, the author of [Module Federation](https:/
30
30
 
31
31
  Modern.js can be used with any community state management library, such as [Redux](https://redux.js.org/), [Jotai](https://jotai.org/), [Zustand](https://docs.pmnd.rs/zustand), [Valtio](https://valtio.pmnd.rs/), and more.
32
32
 
33
- Modern.js also provides a wrapper around Redux called Reduck for state management. You can refer to ["Reduck State Management"](/en/guides/topic-detail/model/quick-start) for usage.
34
-
35
33
  ## Package Manager
36
34
 
37
35
  Modern.js can be used with any community package manager, such as [npm](https://www.npmjs.com/package/npm), [yarn](https://classic.yarnpkg.com/lang/en/), [pnpm](https://pnpm.io/), or [Bun](https://bun.sh/).
@@ -62,7 +60,7 @@ During production builds, Modern.js uses [Terser](https://github.com/terser/ters
62
60
 
63
61
  Modern.js uses [PostCSS](https://postcss.org/) to transform CSS code and enables [autoprefixer](https://github.com/postcss/autoprefixer) by default to add CSS prefixes.
64
62
 
65
- Modern.js supports enabling ["Tailwind CSS"](/en/guides/basic-features/css.html#using-tailwind-css) and is compatible with both Tailwind CSS v2 and v3.
63
+ Modern.js supports enabling ["Tailwind CSS"](/guides/basic-features/css/tailwindcss) and is compatible with both Tailwind CSS v2 and v3.
66
64
 
67
65
  ## CSS Preprocessors
68
66
 
@@ -75,11 +73,11 @@ Modern.js supports three CSS preprocessors: [Sass](https://sass-lang.com/), [Les
75
73
 
76
74
  Modern.js provides out-of-the-box support for [CSS Modules](https://github.com/css-modules/css-modules), which is implemented internally based on [css-loader](https://www.npmjs.com/package/css-loader).
77
75
 
78
- Please refer to ["Use CSS Modules"](/guides/basic-features/css-modules) for usage instructions.
76
+ Please refer to ["Use CSS Modules"](/guides/basic-features/css/css-modules) for usage instructions.
79
77
 
80
78
  ## CSS-in-JS
81
79
 
82
- Modern.js supports the use of [styled-components](https://styled-components.com/). Please refer to ["Using CSS-in-JS"](/en/guides/basic-features/css.html#using-css-in-js) for usage instructions.
80
+ Modern.js supports the use of [styled-components](https://styled-components.com/). Please refer to ["Using CSS-in-JS"](/en/guides/basic-features/css/css-in-js) for usage instructions.
83
81
 
84
82
  If you need to use other CSS-in-JS solutions, you can integrate them into your project on your own.
85
83
 
@@ -91,7 +89,7 @@ Additionally, Modern.js provides built-in support for [on-demand import](/config
91
89
 
92
90
  ## Component Development
93
91
 
94
- Modern.js supports the use of [Storybook](https://storybook.js.org/) for developing UI components. This feature is optional. Please refer to ["Using Storybook"](/en/guides/advanced-features/using-storybook) to enable it.
92
+ Modern.js supports the use of [Storybook](https://storybook.js.org/) for developing UI components. This feature is optional. Please refer to ["Using Storybook"](/guides/basic-features/debug/using-storybook) to enable it.
95
93
 
96
94
  ## Node.js Framework
97
95
 
@@ -37,10 +37,24 @@ import ReleaseNote from '@site-docs-en/components/release-note';
37
37
  <ReleaseNote />
38
38
 
39
39
  :::tip
40
- When upgrading, you need to upgrade all packages provided by Modern.js, instead of upgrading a single dependency.
41
-
40
+ When upgrading, you need to upgrade all packages provided by Modern.js, rather than upgrading some dependencies.
42
41
  :::
43
42
 
43
+ ## Version Management Strategy
44
+
45
+ In Modern.js projects, we recommend that all officially provided dependencies use fixed version, and avoid using `^` or `~` for range declarations. For example:
46
+
47
+ ```json
48
+ {
49
+ "dependencies": {
50
+ "@modern-js/app-tools": "x.y.z"
51
+ }
52
+ }
53
+ ```
54
+
55
+ This ensures that the versions of dependencies are fully determined, thereby guaranteeing build consistency and predictability.
56
+
57
+
44
58
  ## Lock nested dependency
45
59
 
46
60
  When a nested dependency of the project has a problem and Modern.js cannot be updated immediately, you can use the package manager to lock the version of the nested dependency.
@@ -7,4 +7,4 @@
7
7
  "extend",
8
8
  "plugin-api",
9
9
  "hook-list"
10
- ]
10
+ ]
@@ -14,4 +14,4 @@
14
14
  "name": "plugin",
15
15
  "label": "generator-plugin"
16
16
  }
17
- ]
17
+ ]
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -40,16 +40,6 @@ import PackageManager from '@site-docs-en/components/package-manager';
40
40
 
41
41
  <PackageManager />
42
42
 
43
- ### buildTools
44
-
45
- Question: Please select the bundler.
46
-
47
- Options:
48
-
49
- - webpack -- webpack
50
-
51
- - Rspack -- rspack
52
-
53
43
  ## Npm Module
54
44
 
55
45
  ### packageName
@@ -35,7 +35,6 @@ npx @modern-js/create@latest web-app
35
35
  ? Please select the type of project you want to create: Web App
36
36
  ? Please select the programming language: TS
37
37
  ? Please select the package manager: pnpm
38
- ? Please select the bundler: webpack
39
38
  ```
40
39
 
41
40
  ### Create an Npm Module Project
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -8,4 +8,4 @@
8
8
  "name": "api",
9
9
  "label": "API"
10
10
  }
11
- ]
11
+ ]
@@ -1,6 +1 @@
1
- [
2
- "dependencies",
3
- "cli",
4
- "builder",
5
- "hmr"
6
- ]
1
+ ["dependencies", "cli", "builder", "hmr"]
@@ -294,7 +294,7 @@ A Utility Class named `custom-text-gray` is implemented in `src/routes/styles/ut
294
294
  ```
295
295
 
296
296
  :::info note
297
- Modern.js integrates with [PostCSS](/guides/basic-features/css) and supports modern CSS syntax features such as [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).
297
+ Modern.js integrates with [PostCSS](/guides/basic-features/css/css) and supports modern CSS syntax features such as [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).
298
298
 
299
299
  :::
300
300
 
@@ -52,7 +52,7 @@ function useLoader(loaderFn: LoaderFn, options: Options): ReturnData;
52
52
  - `initialData`:首次执行前的初始数据,对应返回值中的 `data` 字段。
53
53
  - `skip`:当值为 `true` 时,函数不执行。
54
54
  - `params`:当 `params` 序列化结果发生改变时,函数会重新执行。同时,`params` 也会作为函数的第二个参数被传入。
55
- - `static`:当值为 `true` 时,`useLoader` 用于 [SSG](/guides/advanced-features/ssg) 编译阶段数据的获取。
55
+ - `static`:当值为 `true` 时,`useLoader` 用于 [SSG](/guides/basic-features/render/ssg) 编译阶段数据的获取。
56
56
 
57
57
  ### 返回值
58
58
 
@@ -1,6 +1 @@
1
- [
2
- "overview",
3
- "v2-release-note",
4
- "2022-0910-updates",
5
- "2022-0708-updates"
6
- ]
1
+ ["overview", "v2-release-note", "2022-0910-updates", "2022-0708-updates"]
@@ -1 +1 @@
1
- 本地验证完成后,可以将 `dist/` 下的产物整理成服务器需要的结构,进行部署。
1
+ 本地验证完成后,可以参考 [部署](/guides/basic-features/deploy.html) 一节,将项目部署到服务器上。
@@ -4,7 +4,6 @@
4
4
  ? 请选择你想创建的工程类型 Web 应用
5
5
  ? 请选择开发语言 TS
6
6
  ? 请选择包管理工具 pnpm
7
- ? 请选择构建工具 webpack
8
7
  ```
9
8
 
10
9
  在生成项目后,Modern.js 会自动安装依赖、创建 git 仓库。
@@ -3,5 +3,4 @@ $ npx @modern-js/create@latest myapp
3
3
  ? 请选择你想创建的工程类型:Web 应用
4
4
  ? 请选择开发语言:TS
5
5
  ? 请选择包管理工具:pnpm
6
- ? 请选择构建工具:Rspack
7
6
  ```
@@ -0,0 +1,3 @@
1
+ :::note
2
+ 敬请期待
3
+ :::
@@ -75,4 +75,4 @@
75
75
  },
76
76
  "app/builder-plugins",
77
77
  "app/auto-load-plugin"
78
- ]
78
+ ]