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 bd9ec8c

Browse files
committed
update webpack-code-splitting README.md
1 parent 7c4834e commit bd9ec8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,6 @@ require(["module-a", "module-b"], function(a, b) {
247247
## 3. 总结
248248
1. chunk分为entry chunk和normal chunk。
249249

250-
2. entry chunk是入口文件,在不考虑Code Splitting的情况下,single entry只会生成一个chunk,即一个entry chunk,可通过`output.fileName`指定输出的文件名。 如果single entry中有代码分离点,那么需要通过`output.chunkName`设置新生成的normal chunk文件名。multiple entry会产生多个entry chunk,需要通过`ouput.chunkName`指定各个chunk的文件名。一般情况下,entry chunk = webpack runtime + modules.
250+
2. entry chunk是入口文件,在不考虑Code Splitting的情况下,single entry只会生成一个chunk,即一个entry chunk,可通过`output.fileName`指定输出的文件名。 如果single entry中有代码分离点,那么需要通过`output.chunkName`设置新生成的normal chunk文件名。multiple entry会产生多个entry chunk,需要通过`ouput.fileName`指定各个entry chunk的文件名,且要通过`[id]``[name]`等设置`ouput.fileName`的值,这样使得不同的entry chunk具有不同的文件名。一般情况下,entry chunk = webpack runtime + modules.
251251

252252
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 によって変換されたページ (->オリジナル) /