Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack概念分析,Bundle vs Chunk #30

Open
AndreGeng opened this issue Apr 29, 2019 · 0 comments
Open

webpack概念分析,Bundle vs Chunk #30

AndreGeng opened this issue Apr 29, 2019 · 0 comments

Comments

@AndreGeng
Copy link
Owner

如何理解module, bundle, entry chunk, initial chunk, normal chunk

  1. 我们在代码中的require或者import的都属于module,这点很好理解
  2. bundle是指webpack这种bundler,output生成的那些文件
  3. entry chunk是指包含wepback runtime的chunk
  4. initial chunk是指那些同步加载的,不包含runtime code的chunk. 比如我们通过optimization.runtimeChunk把runtime分离出来后,得到的chunk, 如下:
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["index"],{

/***/ "./index.js":
/*!******************!*\
  !*** ./index.js ***!
  \******************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("console.log('Hello World!');\n\n\n//# sourceURL=webpack:///./index.js?");

/***/ })

},[["./index.js","runtime"]]]);

  1. normal chunk是指那些通过代码分割点(require.ensure, import(), System.import())生成的那些异步加载的代码。

具体解释可以参见这里:Bundle vs Chunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant