Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 293712d

Browse files
committed
update README.md
1 parent 3f7f3c6 commit 293712d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎tutorials/webpack-code-splitting/README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = "module d";
4949

5050
我们首先看一下最简单的`entry chunk`
5151

52-
## entry chunk
52+
## 1. entry chunk
5353
`page1.js`中引入了`a.js``b.js`模块,如下所示:
5454
```
5555
import a from "./a.js";
@@ -68,7 +68,7 @@ console.log("module c: ", c);
6868
console.log("module d: ", d);
6969
```
7070

71-
### string entry
71+
### 1.1 string entry
7272
`webpack.config.js`中的`entry`用于设置打包的入口文件,即要将哪些资源进行打包。`output.path``output.filename`分别用于设置打包的输出目录和输出文件。
7373

7474
我们将`webpack.config.js`配置如下所示:
@@ -89,13 +89,13 @@ output: {
8989
`page1.bundle.js` = webpack runtime + a.js + b.js
9090
```
9191

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"`的值意义不大,大家知道其输出文件名的含义即可。
9393

94-
### array entry
94+
### 1.2 array entry
9595

96-
### object entry
96+
### 1.3 object entry
9797

98-
## normal chunk
98+
## 2. normal chunk
9999
`page3.js`文件如下所示:
100100
```
101101
import a from "./a.js";

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /