@modern-js/main-doc 2.32.0 → 2.32.2-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/docs/en/apis/app/runtime/app/define-config.mdx +2 -2
  3. package/docs/en/apis/app/runtime/model/auto-actions.mdx +2 -2
  4. package/docs/en/apis/app/runtime/model/model_.mdx +0 -1
  5. package/docs/en/apis/app/runtime/model/use-static-model.mdx +1 -1
  6. package/docs/en/components/enable-bff-caution.mdx +1 -1
  7. package/docs/en/configure/app/auto-load-plugin.mdx +2 -2
  8. package/docs/en/configure/app/bff/_category_.json +1 -1
  9. package/docs/en/configure/app/builder-plugins.mdx +2 -2
  10. package/docs/en/configure/app/dev/_category_.json +1 -1
  11. package/docs/en/configure/app/experiments/_category_.json +1 -1
  12. package/docs/en/configure/app/html/_category_.json +1 -1
  13. package/docs/en/configure/app/output/_category_.json +1 -1
  14. package/docs/en/configure/app/output/ssg.mdx +1 -1
  15. package/docs/en/configure/app/plugins.mdx +0 -1
  16. package/docs/en/configure/app/runtime/_category_.json +1 -1
  17. package/docs/en/configure/app/security/_category_.json +1 -1
  18. package/docs/en/configure/app/server/_category_.json +1 -1
  19. package/docs/en/configure/app/source/_category_.json +1 -1
  20. package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
  21. package/docs/en/configure/app/source/mainEntryName.mdx +1 -1
  22. package/docs/en/configure/app/testing/_category_.json +1 -1
  23. package/docs/en/configure/app/tools/_category_.json +1 -1
  24. package/docs/en/configure/app/tools/tailwindcss.mdx +45 -5
  25. package/docs/en/guides/advanced-features/bff/_category_.json +1 -1
  26. package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -2
  27. package/docs/en/guides/advanced-features/bff/function.mdx +1 -1
  28. package/docs/en/guides/advanced-features/code-split.mdx +2 -2
  29. package/docs/en/guides/advanced-features/eslint.mdx +2 -2
  30. package/docs/en/guides/advanced-features/low-level.mdx +2 -2
  31. package/docs/en/guides/advanced-features/ssg.mdx +2 -3
  32. package/docs/en/guides/advanced-features/ssr.mdx +2 -3
  33. package/docs/en/guides/advanced-features/testing.mdx +3 -3
  34. package/docs/en/guides/advanced-features/using-storybook.mdx +1 -1
  35. package/docs/en/guides/advanced-features/web-server.mdx +2 -2
  36. package/docs/en/guides/basic-features/alias.mdx +3 -3
  37. package/docs/en/guides/basic-features/css.mdx +27 -64
  38. package/docs/en/guides/basic-features/data-fetch.mdx +2 -2
  39. package/docs/en/guides/basic-features/env-vars.mdx +2 -2
  40. package/docs/en/guides/basic-features/html.mdx +0 -1
  41. package/docs/en/guides/basic-features/mock.mdx +4 -4
  42. package/docs/en/guides/basic-features/proxy.mdx +3 -3
  43. package/docs/en/guides/basic-features/routes.mdx +1 -2
  44. package/docs/en/guides/concept/builder.mdx +2 -2
  45. package/docs/en/guides/concept/entries.mdx +1 -1
  46. package/docs/en/guides/get-started/upgrade.mdx +1 -2
  47. package/docs/en/guides/topic-detail/framework-plugin/hook.mdx +2 -2
  48. package/docs/en/guides/topic-detail/generator/plugin/category.md +1 -1
  49. package/docs/en/guides/topic-detail/generator/plugin/context.md +1 -1
  50. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +2 -2
  51. package/docs/en/guides/topic-detail/model/auto-actions.mdx +1 -1
  52. package/docs/en/guides/topic-detail/model/performance.mdx +2 -1
  53. package/docs/en/guides/topic-detail/model/typescript-best-practice.mdx +1 -1
  54. package/docs/en/guides/topic-detail/model/use-model.mdx +1 -1
  55. package/docs/en/tutorials/first-app/c05-loader.mdx +0 -2
  56. package/docs/zh/community/releases.mdx +1 -1
  57. package/docs/zh/community/team.mdx +1 -1
  58. package/docs/zh/components/enable-bff-caution.mdx +2 -2
  59. package/docs/zh/configure/app/auto-load-plugin.mdx +2 -3
  60. package/docs/zh/configure/app/bff/_category_.json +2 -2
  61. package/docs/zh/configure/app/builder-plugins.mdx +2 -3
  62. package/docs/zh/configure/app/deploy/_category_.json +1 -1
  63. package/docs/zh/configure/app/dev/_category_.json +2 -2
  64. package/docs/zh/configure/app/experiments/_category_.json +2 -2
  65. package/docs/zh/configure/app/html/_category_.json +2 -2
  66. package/docs/zh/configure/app/output/_category_.json +2 -2
  67. package/docs/zh/configure/app/output/ssg.mdx +1 -1
  68. package/docs/zh/configure/app/performance/_category_.json +1 -1
  69. package/docs/zh/configure/app/plugins.mdx +1 -2
  70. package/docs/zh/configure/app/runtime/_category_.json +2 -2
  71. package/docs/zh/configure/app/security/_category_.json +2 -2
  72. package/docs/zh/configure/app/server/_category_.json +2 -2
  73. package/docs/zh/configure/app/source/_category_.json +2 -2
  74. package/docs/zh/configure/app/testing/_category_.json +2 -2
  75. package/docs/zh/configure/app/tools/_category_.json +2 -2
  76. package/docs/zh/configure/app/tools/tailwindcss.mdx +44 -6
  77. package/docs/zh/guides/advanced-features/bff/_category_.json +1 -1
  78. package/docs/zh/guides/advanced-features/code-split.mdx +2 -2
  79. package/docs/zh/guides/advanced-features/compatibility.mdx +1 -1
  80. package/docs/zh/guides/advanced-features/eslint.mdx +1 -1
  81. package/docs/zh/guides/advanced-features/low-level.mdx +2 -2
  82. package/docs/zh/guides/advanced-features/rspack-start.mdx +0 -1
  83. package/docs/zh/guides/advanced-features/ssg.mdx +3 -4
  84. package/docs/zh/guides/advanced-features/ssr.mdx +2 -3
  85. package/docs/zh/guides/advanced-features/testing.mdx +2 -2
  86. package/docs/zh/guides/advanced-features/using-storybook.mdx +1 -1
  87. package/docs/zh/guides/advanced-features/web-server.mdx +2 -2
  88. package/docs/zh/guides/basic-features/alias.mdx +3 -3
  89. package/docs/zh/guides/basic-features/css.mdx +27 -64
  90. package/docs/zh/guides/basic-features/data-fetch.mdx +1 -2
  91. package/docs/zh/guides/basic-features/env-vars.mdx +1 -1
  92. package/docs/zh/guides/basic-features/mock.mdx +2 -2
  93. package/docs/zh/guides/basic-features/proxy.mdx +3 -3
  94. package/docs/zh/guides/basic-features/routes.mdx +1 -2
  95. package/docs/zh/guides/concept/builder.mdx +1 -1
  96. package/docs/zh/guides/concept/entries.mdx +3 -3
  97. package/docs/zh/guides/get-started/upgrade.mdx +1 -2
  98. package/modern.config.ts +8 -0
  99. package/package.json +5 -5
  100. package/src/i18n/enUS.ts +1 -1
  101. package/src/i18n/zhCN.ts +1 -1
  102. package/docs/en/configure/app/source/design-system.mdx +0 -1175
  103. package/docs/zh/configure/app/source/design-system.mdx +0 -1174
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.32.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - bc1f8daf0ff: feat(builder): support custom logger in dev server
8
+
9
+ feat(builder): 支持自定义 logger
10
+
11
+ - @modern-js/builder-doc@2.32.2-alpha.0
12
+
13
+ ## 2.32.1
14
+
15
+ ### Patch Changes
16
+
17
+ - @modern-js/builder-doc@2.32.1
18
+
3
19
  ## 2.32.0
4
20
 
5
21
  ### Patch Changes
@@ -53,9 +53,9 @@ defineConfig(App, {
53
53
 
54
54
  ```json
55
55
  {
56
- // 来自 `modern.config.js`
56
+ // From `modern.config.js`
57
57
  ...runtime.router
58
- // 来自 `defineConfig`
58
+ // From `defineConfig`
59
59
  ...config.router
60
60
  }
61
61
  ```
@@ -57,9 +57,9 @@ State type is Array, generate the following Actions:
57
57
  - usage: `arr.unshift(element1, ..., elementN)`
58
58
  - `elementN`: the element or elements to add to the beginning of the array.
59
59
  - `filter`: filter element.
60
- {/* 语义与原生方法不同, 待修改 API */}
60
+ {/* Semantics are different from native methods, API to be modified */}
61
61
  - `concat`: concat array.
62
- {/* 语义与原生方法不同, 待修改 API */}
62
+ {/* Semantics are different from native methods, API to be modified */}
63
63
  - `splice`: modify the array by deleting or replacing existing elements or adding new elements in place, and return the modified array(Note that it is different from the native `splice` return value).
64
64
  - usage: `splice(start[, deleteCount[, item1[, item2[, ...]]]])`
65
65
  - `start`: specifies the start position of the modification(counting from 0).
@@ -61,7 +61,6 @@ const fooModel = model('foo').define({
61
61
  - `context`: Reduck Context, can get underlying `store` object. `store` support all Redux Store [API](https://redux.js.org/api/store), also mounts the `use` method for consuming the Model, and the `unmount` method for unmounting the Model.
62
62
  - utils: commonly used tool like `use`、`onMount`. `use` is the same as `store.use`, `onMount` is the hook function after the Model is mounted.
63
63
 
64
- {/* TODO: @anchao 调整类型 */}
65
64
  ```ts
66
65
  interface Utils {
67
66
  use: UseModel;
@@ -37,7 +37,7 @@ function App() {
37
37
  const [state] = useStaticModel(userModel);
38
38
 
39
39
  useEffect(() => {
40
- // 统计 UV 数据
40
+ // Statistical UV Data
41
41
  send('pageview', { user: state.user });
42
42
  }, [state]);
43
43
 
@@ -1,3 +1,3 @@
1
1
  :::caution
2
- Please enable BFF functionality in the current application project root directory using [new](/apis/app/commands#modern-new) first.
2
+ Please use the [new command](/apis/app/commands#modern-new) in the root directory of the current project to enable BFF functionality first.
3
3
  :::
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: autoLoadPlugins
3
- sidebar_position: 11
2
+ sidebar_position: 22
4
3
  ---
4
+
5
5
  # autoLoadPlugins
6
6
 
7
7
  - **Type:** `boolean`
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "bff",
3
- "position": 5
3
+ "position": 2
4
4
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: builderPlugins
3
- sidebar_position: 10
2
+ sidebar_position: 21
4
3
  ---
4
+
5
5
  # builderPlugins
6
6
 
7
7
  - **Type:** `BuilderPlugin[]`
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "dev",
3
- "position": 7
3
+ "position": 1
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "experiments",
3
- "position": 15
3
+ "position": 14
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "html",
3
- "position": 2
3
+ "position": 3
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "output",
3
- "position": 2
3
+ "position": 7
4
4
  }
@@ -10,7 +10,7 @@ sidebar_label: ssg
10
10
  Enable the SSG for **Self-controlled Routing** or **Conventional Routing**.
11
11
 
12
12
  :::info
13
- For more routes detail, see [routes](/guides/basic-features/routes).
13
+ For more routes detail, see [Routing](/guides/basic-features/routes).
14
14
 
15
15
  :::
16
16
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- title: plugins
3
2
  sidebar_position: 9
4
3
  ---
5
4
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "runtime",
3
- "position": 3
3
+ "position": 12
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "security",
3
- "position": 14
3
+ "position": 11
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "server",
3
- "position": 4
3
+ "position": 6
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "source",
3
- "position": 1
3
+ "position": 5
4
4
  }
@@ -9,7 +9,7 @@ sidebar_label: enableAsyncEntry
9
9
 
10
10
  This option is used for webpack Module Federation scenario.
11
11
 
12
- When this option is enabled, Modern.js will wrap the automatically generated entry files with Dynamic Imports (Asynchronous Boundaries), allowing page code to consume remote modules generated by Module Federation.
12
+ When this option is enabled, Modern.js will wrap the automatically generated entry files with dynamic import (Asynchronous Boundaries), allowing page code to consume remote modules generated by Module Federation.
13
13
 
14
14
  ## Background
15
15
 
@@ -5,7 +5,7 @@ sidebar_label: mainEntryName
5
5
  # source.mainEntryName
6
6
 
7
7
  - **Type:** `string`
8
- - **Default value:** `main`
8
+ - **Default:** `main`
9
9
 
10
10
  This option is used to configure the main entry name of Modern.js.
11
11
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "testing",
3
- "position": 8
3
+ "position": 10
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "tools",
3
- "position": 12
3
+ "position": 4
4
4
  }
@@ -14,11 +14,17 @@ const tailwind = {
14
14
  './config/html/**/*.{html,ejs,hbs}',
15
15
  './storybook/**/*',
16
16
  ],
17
- // Use source.design System config as Tailwind CSS theme config
18
- theme: source.designSystem,
19
17
  };
20
18
  ```
21
19
 
20
+ Used to modify the configuration of [Tailwind CSS](https://tailwindcss.com/docs/configuration).
21
+
22
+ ### Enabling Tailwind CSS
23
+
24
+ Before using `tools.tailwindcss`, you need to enable the Tailwind CSS plugin for Modern.js.
25
+
26
+ Please refer to the section [Using Tailwind CSS](/guides/basic-features/css.html#using-tailwind-css) for instructions on how to enable it.
27
+
22
28
  ### Function Type
23
29
 
24
30
  When `tools.tailwindcss`'s type is Function, the default tailwindcss config will be passed in as the first parameter, the config object can be modified directly, or a value can be returned as the final result.
@@ -51,8 +57,42 @@ export default {
51
57
  };
52
58
  ```
53
59
 
54
- ### Limitations
60
+ ### Notes
61
+
62
+ Please note:
63
+
64
+ - If you are using both the `tailwind.config.{ts,js}` file and `tools.tailwindcss` option, the configuration defined in `tools.tailwindcss` will take precedence and override the content defined in `tailwind.config.{ts,js}`.
65
+ - If you are using the `source.designSystem` configuration option simultaneously, the `theme` configuration of Tailwind CSS will be overridden by the value of `source.designSystem`.
66
+
67
+ The usage of other configurations follows the same approach as the official usage of Tailwind CSS. Please refer to [tailwindcss - Configuration](https://tailwindcss.com/docs/configuration) for more details.
68
+
69
+ ### About source.designSystem
70
+
71
+ `source.designSystem` is a deprecated configuration option in Modern.js.
72
+
73
+ Starting from Modern.js vMAJOR_VERSION.33.0, you can use the `theme` configuration option of Tailwind CSS as a replacement for `source.designSystem`. It is no longer necessary to split the `theme` configuration and set it on `designSystem`.
74
+
75
+ - Previous usage:
76
+
77
+ ```ts title="modern.config.ts"
78
+ const { theme, ...rest } = tailwindConfig;
79
+
80
+ export default {
81
+ tools: {
82
+ tailwindcss: rest,
83
+ },
84
+ source: {
85
+ designSystem: theme,
86
+ },
87
+ };
88
+ ```
55
89
 
56
- The `theme` attribute is not allowed, otherwise the build will fail. Modern.js use [source.designSystem](/configure/app/source/design-system) as the Tailwind CSS Theme configuration.
90
+ - Current usage:
57
91
 
58
- Other uses are consistent with [Tailwind CSS](https://tailwindcss.com/docs/configuration).
92
+ ```ts title="modern.config.ts"
93
+ export default {
94
+ tools: {
95
+ tailwindcss: tailwindConfig,
96
+ },
97
+ };
98
+ ```
@@ -1,5 +1,5 @@
1
1
  {
2
- "label": "BFF",
2
+ "label": "Using BFF",
3
3
  "position": 2,
4
4
  "link": {
5
5
  "type": "doc",
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  sidebar_position: 3
3
- title: Frameworks
4
3
  ---
4
+
5
5
  # Frameworks
6
6
 
7
- Modern.js's BFF supports different runtime frameworks, currently Modern.js's BFF supports two runtime frameworks[Express.js](https://expressjs.com/) [Koa.js](https://koajs.com/).
7
+ Modern.js's BFF supports different runtime frameworks, currently Modern.js's BFF supports two runtime frameworks: [Express.js](https://expressjs.com/) and [Koa.js](https://koajs.com/).
8
8
 
9
9
  ## Function Mode
10
10
 
@@ -224,7 +224,7 @@ export default () => {
224
224
  });
225
225
  };
226
226
 
227
- return <div onClick={addSku}>添加 SKU</div>;
227
+ return <div onClick={addSku}>Add SKU</div>;
228
228
  };
229
229
  ```
230
230
 
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Code Split
3
- sidebar_position: 6
2
+ sidebar_position: 3
4
3
  ---
4
+
5
5
  # Code Splitting
6
6
 
7
7
  Code splitting is a common way to optimize frontend resource loading. This article will introduce the three types of code splitting supported by Modern.js:
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: ESLint
3
2
  sidebar_position: 8
4
3
  ---
5
- # ESLint
4
+
5
+ # ESLint Rules
6
6
 
7
7
  **Modern.js ESLint Rules** is the full set of **ESLint** rules, includes `@modern-js` (Lint rules for Node.js projects) and `@modern-js-app` (Lint rules for web projects).
8
8
 
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Low-Level Tools
3
- sidebar_position: 11
2
+ sidebar_position: 10
4
3
  ---
4
+
5
5
  # Low-Level Tools
6
6
 
7
7
  ## Usage
@@ -1,6 +1,5 @@
1
1
  ---
2
- title: Static Site Generation
3
- sidebar_position: 4
2
+ sidebar_position: 5
4
3
  ---
5
4
 
6
5
  # Static Site Generation
@@ -55,7 +54,7 @@ The above file directory will generate the following three routes:
55
54
  - `/user/profile`
56
55
 
57
56
  :::note
58
- If you are not familiar with the rules of Conventional Routing, you can first check [routes](/guides/basic-features/routes).
57
+ If you are not familiar with the rules of Conventional Routing, you can first check [Routing](/guides/basic-features/routes).
59
58
 
60
59
  :::
61
60
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: Server-side rendering
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
5
4
 
6
- # Server-side rendering
5
+ # Server-Side Rendering
7
6
 
8
7
  In Modern.js, SSR is readily available without the need for developers to write intricate server-level logic or worry about the operation and maintenance of SSR services. Additionally, Modern.js includes a comprehensive degradation strategy for SSR to ensure safe page execution.
9
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- sidebar_position: 10
3
- title: Testing
2
+ sidebar_position: 11
4
3
  ---
5
- # Testing
4
+
5
+ # Using Jest
6
6
 
7
7
  Modern.js integrates the testing capabilities of [Jest](https://jestjs.io/) by default.
8
8
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 20
2
+ sidebar_position: 12
3
3
  ---
4
4
 
5
5
  # Using Storybook
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Custom Web Server
3
- sidebar_position: 3
2
+ sidebar_position: 13
4
3
  ---
4
+
5
5
  # Custom Web Server
6
6
 
7
7
  As a client-centric development framework, Modern.js has limited customization capabilities on the server side. However, in some development scenarios, special server-level logic needs to be customized, such as user authentication, request preprocessing, and adding page rendering skeletons.
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Alias
3
- sidebar_position: 8
2
+ sidebar_position: 3
4
3
  ---
5
- # Alias
4
+
5
+ # Path Alias
6
6
 
7
7
  Modern.js allows you to use alias to import modules from custom directories in JS and CSS, and comes with the following built-in alias:
8
8
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 2
3
3
  ---
4
4
 
5
- # CSS Solutions
5
+ # Styling
6
6
 
7
7
  Modern.js has built-in a variety of commonly used CSS solutions, including Less / Sass / Stylus preprocessors, PostCSS, CSS Modules, CSS-in-JS, and Tailwind CSS.
8
8
 
@@ -103,47 +103,46 @@ Depending on your needs, you can selectively import the CSS files provided by Ta
103
103
 
104
104
  :::
105
105
 
106
- ### Tailwind CSS Autocomplete
107
-
108
- Tailwind CSS provides an official extension called [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code.
106
+ ### Configuring Tailwind CSS
109
107
 
110
- You can follow the steps below to enable the autocompletion feature:
108
+ In Modern.js, you have two ways to configure Tailwind CSS:
111
109
 
112
- 1. Install the [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) extension in VS Code.
113
- 2. Create a `tailwind.config.ts` file in the root directory of your project and write the desired Tailwind CSS configuration.
110
+ 1. Using the `tailwind.config.{ts,js}` file, which follows the official usage of Tailwind CSS. Please refer to ["Tailwind CSS - Configuration"](https://tailwindcss.com/docs/configuration) for more details.
114
111
 
115
112
  ```ts title="tailwind.config.ts"
113
+ import type { Config } from 'tailwindcss';
114
+
116
115
  export default {
117
- content: [
118
- './src/**/*.{js,jsx,ts,tsx}',
119
- './config/html/**/*.{html,ejs,hbs}',
120
- './storybook/**/*',
121
- ],
122
- // Theme configuration (optional)
123
- theme: {},
124
- };
116
+ content: ['./src/**/*.{js,jsx,ts,tsx}'],
117
+ } as Config;
125
118
  ```
126
119
 
127
- 3. In the `modern.config.ts` file, import the `tailwind.config.ts` file you created, so that Modern.js can recognize the Tailwind CSS configuration correctly.
120
+ :::tip
121
+ Please upgrade Modern.js to version >= MAJOR_VERSION.33.0 to support automatic reading of `tailwind.config.{ts,js}` files.
122
+ :::
128
123
 
129
- ```ts title="modern.config.ts"
130
- import tailwindConfig from './tailwind.config';
124
+ 2. Using the [tools.tailwindcss](/configure/app/tools/tailwindcss.html) configuration option. This is the old way of configuring Tailwind CSS, and we recommend using the `tailwind.config.{ts,js}` file for configuration.
131
125
 
132
- export default defineConfig({
126
+ ```ts title="modern.config.ts"
127
+ export default {
133
128
  tools: {
134
- tailwindcss: tailwindConfig,
135
- },
136
- // Theme configuration (optional)
137
- source: {
138
- designSystem: tailwindConfig.theme,
129
+ tailwindcss: {
130
+ content: ['./src/**/*.{js,jsx,ts,tsx}'],
131
+ },
139
132
  },
140
- });
133
+ };
141
134
  ```
142
135
 
143
- Please read the documentation for the following configuration options to understand their functions:
136
+ If you are using both the `tailwind.config.{ts,js}` file and `tools.tailwindcss` option, the configuration defined in `tools.tailwindcss` will take precedence and override the content defined in `tailwind.config.{ts,js}`.
144
137
 
145
- - [tools.tailwindcss](/configure/app/tools/tailwindcss).
146
- - [source.designSystem](/configure/app/source/design-system).
138
+ ### Tailwind CSS Autocomplete
139
+
140
+ Tailwind CSS provides an official extension called [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code.
141
+
142
+ You can follow the steps below to enable the autocomplete feature:
143
+
144
+ 1. Install the [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) extension in VS Code.
145
+ 2. If the root directory of your project does not have a `tailwind.config.{ts,js}` file, you need to create one and write the Tailwind CSS configuration for your current project. Otherwise, the IDE plugin will not work correctly.
147
146
 
148
147
  ### Tailwind CSS Version
149
148
 
@@ -162,39 +161,3 @@ Tailwind CSS v2 and v3 do not support the IE 11 browser, please refer to:
162
161
  - [Tailwind CSS v2 - Browser Support](https://v2.tailwindcss.com/docs/browser-support)
163
162
 
164
163
  If you use Tailwind CSS on IE 11 browser, some styles may not be available, please use it with caution.
165
-
166
- ### Theme Configuration
167
-
168
- When you need to customize the [theme](https://tailwindcss.com/docs/theme) configuration of Tailwind CSS, you can modify it in the [`source.designSystem`](/configure/app/source/design-system) configuration. For example, adding a `primary` color theme:
169
-
170
- ```ts title="modern.config.ts"
171
- export default defineConfig({
172
- source: {
173
- designSystem: {
174
- extend: {
175
- colors: {
176
- primary: '#5c6ac4',
177
- },
178
- },
179
- },
180
- },
181
- });
182
- ```
183
-
184
- When you need to make other special configurations to Tailwind CSS besides [theme](https://tailwindcss.com/docs/theme), you can configure them in [`tools.tailwindcss`](/configure/app/tools/tailwindcss), such as setting `variants`:
185
-
186
- ```ts title="modern.config.ts"
187
- export default defineConfig({
188
- tools: {
189
- tailwindcss: {
190
- variants: {
191
- extend: {
192
- backgroundColor: ['active'],
193
- },
194
- },
195
- },
196
- },
197
- });
198
- ```
199
-
200
- > When you configure Tailwind CSS for your project, the combination of [source.designSystem](/configure/app/source/design-system) and [tools.tailwindcss](/configure/app/tools/tailwindcss) configurations is equivalent to configuring a `tailwindcss.config.js` file separately. [source.designSystem](/configure/app/source/design-system) is equivalent to the Tailwind CSS [theme](https://v2.tailwindcss.com/docs/configuration#theme) configuration.
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Data Fetching
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
4
+
5
5
  # Data Fetching
6
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.
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Environment Variable
3
2
  sidebar_position: 7
4
3
  ---
5
- # Environment Variable
4
+
5
+ # Environment Variables
6
6
 
7
7
  Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
8
8
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- title: HTML Template
3
2
  sidebar_position: 9
4
3
  ---
5
4
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Mock
3
- sidebar_position: 6
2
+ sidebar_position: 5
4
3
  ---
5
- # Mock
4
+
5
+ # Data Mocking
6
6
 
7
7
  Modern.js allows you to easily generate mock data so that the front-end can develop independently without depending on the back-end API.
8
8
 
@@ -52,7 +52,7 @@ const Mock = require('mockjs');
52
52
  module.exports = {
53
53
  '/api/getInfo': Mock.mock({
54
54
  'data|1-10': [{ name: '@cname' }],
55
- }) /* => {data: [{name: "董霞"}, {name: "魏敏"}, {name: "石磊"}} */,
55
+ }) /* => {data: [{name: "Jack"}, {name: "Jim"}, {name: "Mary"}} */,
56
56
  };
57
57
  ```
58
58
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Proxy
3
- sidebar_position: 5
2
+ sidebar_position: 6
4
3
  ---
5
- # Proxy
4
+
5
+ # Network Proxy
6
6
 
7
7
  ## Local Proxy
8
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: Routes
3
2
  sidebar_position: 1
4
3
  ---
5
4
 
6
- # Routes
5
+ # Routing
7
6
 
8
7
  Modern.js's routing is based on [React Router 6](https://reactrouter.com/en/main) and provides multiple types of routing modes. According to different [entry](/guides/concept/entries) types, routing is divided into three modes: **Conventional Routing**, **Self-controlled Routing**, and **Other**.
9
8
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 2
3
3
  ---
4
4
 
5
- # Builder
5
+ # Build Engine
6
6
 
7
7
  **Modern.js uses [Modern.js Builder](https://modernjs.dev/builder/en) to build your Web App.**
8
8
 
@@ -16,7 +16,7 @@ From a building perspective, Modern.js is divided into three layers, from top to
16
16
  - Common build engine: Modern.js Builder.
17
17
  - Low-level bundler: webpack and Rspack.
18
18
 
19
- <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
19
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-0824.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## Builder Documentation
22
22
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 1
3
3
  ---
4
4
 
5
- # Entry
5
+ # Page Entry
6
6
 
7
7
  In this chapter, you will learn about the entry convention in Modern.js and how to customize it.
8
8