File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
tutorials/webpack-code-splitting Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ module.exports = "module d";
49
49
50
50
我们首先看一下最简单的` entry chunk ` 。
51
51
52
- ## entry chunk
52
+ ## 1. entry chunk
53
53
` page1.js ` 中引入了` a.js ` 和` b.js ` 模块,如下所示:
54
54
```
55
55
import a from "./a.js";
@@ -68,7 +68,7 @@ console.log("module c: ", c);
68
68
console.log("module d: ", d);
69
69
```
70
70
71
- ### string entry
71
+ ### 1.1 string entry
72
72
` webpack.config.js ` 中的` entry ` 用于设置打包的入口文件,即要将哪些资源进行打包。` output.path ` 、` output.filename ` 分别用于设置打包的输出目录和输出文件。
73
73
74
74
我们将` webpack.config.js ` 配置如下所示:
@@ -89,13 +89,13 @@ output: {
89
89
`page1.bundle.js` = webpack runtime + a.js + b.js
90
90
```
91
91
92
- 我们再次做点修改,将filename设置为 ` filename: "[id].[name].bundle.js" ` ,此处的` [id] ` 表示chunk id,` [name] ` 表示chunk name,执行` npm start ` 重新进行打包,在` buildOutput ` 目录下生成打包文件` 0.main.js ` ,也就是说我们生成的entry chunk的id为0,chunk name为` main ` 。在只有entry chunk这一种chunk的情况下,将` filename ` 设置为类似于` "[id].[name].bundle.js" ` 的值意义不大,大家知道其输出文件名的含义即可。
92
+ 我们对 ` filename ` 做点修改,将设置为 ` filename: "[id].[name].bundle.js" ` ,此处的` [id] ` 表示chunk id,` [name] ` 表示chunk name,执行` npm start ` 重新进行打包,在` buildOutput ` 目录下生成打包文件` 0.main.js ` ,也就是说我们生成的entry chunk的id为0,chunk name为` main ` 。在只有entry chunk这一种chunk的情况下,将` filename ` 设置为类似于` "[id].[name].bundle.js" ` 的值意义不大,大家知道其输出文件名的含义即可。
93
93
94
- ### array entry
94
+ ### 1.2 array entry
95
95
96
- ### object entry
96
+ ### 1.3 object entry
97
97
98
- ## normal chunk
98
+ ## 2. normal chunk
99
99
` page3.js ` 文件如下所示:
100
100
```
101
101
import a from "./a.js";
You can’t perform that action at this time.
0 commit comments