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 da9f6c7

Browse files
committed
update webpack-code-splitting
1 parent ae10ff6 commit da9f6c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,6 @@ require(["module-a", "module-b"], function(a, b) {
245245
## 3. 总结
246246
1. chunk分为entry chunk和normal chunk。
247247

248-
2. entry chunk是入口文件,它的名字一般通过`output.filename`指定。一般情况下,entry chunk = webpack runtime + modules.
248+
2. entry chunk是入口文件,一般情况下(不考虑Code Splitting),single entry只会生成一个chunk,即一个entry chunk,可通过`output.fileName`指定输出的文件名。 multiple entry会产生多个entry chunk,需要通过`ouput.chunkName`指定各个chunk的文件名。一般情况下,entry chunk = webpack runtime + modules.
249249

250-
3. 通过代码`require.ensure([], function(...){})``require([amd1, amd2], function(amd1, amd2){})`可以设置代码的分离点(Code Splitting Point),Webpack会将其创建一个新的normal chunk。一般情况下,normal chunk不包含webpack runtime,只包含一些modules代码。
250+
3. normal chunk一般是被entry chunk在运行时动态加载的文件,通过代码`require.ensure([], function(...){})``require([amd1, amd2], function(amd1, amd2){})`可以设置代码的分离点(Code Splitting Point),Webpack会将其创建一个新的normal chunk。一般情况下,normal chunk不包含webpack runtime,只包含一些modules代码。生成的normal chunk的文件名可以通过`output.chunkName`设定,在代码分离点处我们可以传入一个chunk name以便在`output.chunkName`中使用`[name]`作为输出的文件名

0 commit comments

Comments
(0)

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