@modern-js/module-tools-docs 2.57.1 → 2.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/docs/en/api/config/build-config.mdx +20 -1
- package/docs/en/guide/advance/in-depth-about-build.md +4 -0
- package/docs/en/guide/faq/basic.mdx +1 -1
- package/docs/zh/api/config/build-config.mdx +18 -0
- package/docs/zh/guide/advance/in-depth-about-build.md +4 -0
- package/docs/zh/guide/faq/basic.mdx +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -753,7 +753,8 @@ Build lifecycle hooks that allow custom logic to be injected at specific stages
|
|
|
753
753
|
```ts
|
|
754
754
|
type HookList = {
|
|
755
755
|
name: string;
|
|
756
|
-
apply: (compiler: ICompiler) => void
|
|
756
|
+
apply: (compiler: ICompiler) => void;
|
|
757
|
+
applyAfterBuiltIn?: boolean;
|
|
757
758
|
}
|
|
758
759
|
|
|
759
760
|
```
|
|
@@ -881,6 +882,24 @@ For more information about JSX Transform, you can refer to the following links:
|
|
|
881
882
|
|
|
882
883
|
:::
|
|
883
884
|
|
|
885
|
+
|
|
886
|
+
## loader
|
|
887
|
+
|
|
888
|
+
**Experimental**
|
|
889
|
+
|
|
890
|
+
This option is used to change the interpretation method of the given input file.
|
|
891
|
+
For example, you need to handle the js file as jsx.
|
|
892
|
+
|
|
893
|
+
```js title="modern.config.ts"
|
|
894
|
+
export default defineConfig({
|
|
895
|
+
buildConfig: {
|
|
896
|
+
loader: {
|
|
897
|
+
'.js': 'jsx',
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
});
|
|
901
|
+
```
|
|
902
|
+
|
|
884
903
|
## metafile
|
|
885
904
|
|
|
886
905
|
This option is used for build analysis. When enabled, esbuild will generate metadata about the build in JSON format.
|
|
@@ -95,6 +95,10 @@ Serial hooks that stop the execution of other tapped functions if a tapped funct
|
|
|
95
95
|
|
|
96
96
|
Serial hooks whose results are passed to the next tapped function.
|
|
97
97
|
|
|
98
|
+
### Hook Order
|
|
99
|
+
|
|
100
|
+
The execution order of hooks follows the registration order. You can control whether a hook is registered before or after the built-in hooks using `applyAfterBuiltIn`.
|
|
101
|
+
|
|
98
102
|
### Hook API
|
|
99
103
|
|
|
100
104
|
#### load
|
|
@@ -9,5 +9,5 @@ Modern.js Module uses esbuild to build toolkits and component libraries, and Rsb
|
|
|
9
9
|
Modern.js Module is based on esbuild for building and cannot use tools from the webpack-related ecosystem.
|
|
10
10
|
You can find more community plugins for esbuild [here](https://github.com/esbuild/community-plugins)
|
|
11
11
|
|
|
12
|
-
If the UMD product produced by Modern.js Module does not meet your requirements, you can use Rsbuild and add [UMD Plugin](https://
|
|
12
|
+
If the UMD product produced by Modern.js Module does not meet your requirements, you can use Rsbuild and add [UMD Plugin](https://github.com/rspack-contrib/rsbuild-plugin-umd) to build UMD products.
|
|
13
13
|
|
|
@@ -744,6 +744,8 @@ export default defineConfig({
|
|
|
744
744
|
type HookList = {
|
|
745
745
|
name: string;
|
|
746
746
|
apply: (compiler: ICompiler) => void;
|
|
747
|
+
// 是否在 buildIn 钩子之后执行
|
|
748
|
+
applyAfterBuiltIn?: boolean;
|
|
747
749
|
};
|
|
748
750
|
```
|
|
749
751
|
|
|
@@ -870,6 +872,22 @@ export default defineConfig({
|
|
|
870
872
|
|
|
871
873
|
:::
|
|
872
874
|
|
|
875
|
+
## loader
|
|
876
|
+
|
|
877
|
+
**试验性功能**
|
|
878
|
+
|
|
879
|
+
此选项用来更改给定输入文件的解释方式。例如你需要将 js 文件当做 jsx 处理
|
|
880
|
+
|
|
881
|
+
```js title="modern.config.ts"
|
|
882
|
+
export default defineConfig({
|
|
883
|
+
buildConfig: {
|
|
884
|
+
loader: {
|
|
885
|
+
'.js': 'jsx',
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
```
|
|
890
|
+
|
|
873
891
|
## metafile
|
|
874
892
|
|
|
875
893
|
这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。
|
|
@@ -9,4 +9,4 @@ Modern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于
|
|
|
9
9
|
Modern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。
|
|
10
10
|
[这里](https://github.com/esbuild/community-plugins)可以发现更多 esbuild 社区插件
|
|
11
11
|
|
|
12
|
-
如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 [UMD Plugin](https://
|
|
12
|
+
如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 [UMD Plugin](https://github.com/rspack-contrib/rsbuild-plugin-umd) 构建 UMD 产物。
|
package/package.json
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"directory": "packages/document/module-doc"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "2.
|
|
12
|
+
"version": "2.58.1",
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"devDependencies": {
|
|
15
|
+
"@rspress/shared": "1.27.0",
|
|
15
16
|
"react": "^18.2.0",
|
|
16
17
|
"react-dom": "^18.2.0",
|
|
17
|
-
"rspress": "1.
|
|
18
|
-
"@
|
|
19
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.57.1"
|
|
18
|
+
"rspress": "1.27.0",
|
|
19
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.58.1"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "rspress dev",
|