webpack
Webpack Glossary
-
bundle
Bundle: Produced from a number of distinct modules, bundles contain the final versions of source files that have already undergone the loading and compilation process.
译:Bundle:由许多不同的
modules
生成,包含了源码处理后的最终版本——源码被加载和编译处理; -
chunk
Chunk: This webpack-specific term is used internally to manage the bundling process. Bundles are composed out of chunks, of which there are several types (e.g. entry and child). Typically, chunks directly correspond with the output bundles however, there are some configurations that don’t yield a one-to-one relationship.
译:chunk:该
webpack
专业术语用于webpack
内部管理bundling
的过程中。bundles
由许多的chunks
组成——这些chunk
有不同的类型(比如entry
或child
)。通常,chunks
直接与bundles
相对应。然而,有一些配置可以使其不是一对一的关系; -
module
Module: Discrete chunks of functionality that provide a smaller surface area than a full program. Well-written modules provide solid abstractions and encapsulation boundaries which make up a coherent design and clear purpose.
译:module:非连续的功能块——提供了更小的表面积而不是整个程序。书写良好的
modules
提供了可靠的抽象及封装边界,组成了统一的设计和清晰的目的;
结合stackoverflow
释疑
module
是webpack
支持解析的模块;
chunk
包含多个module
,存在于webpack处理过程中的阶段;
bundle
包含一个或多个chunk
,是源码经过webpack处理后的最终版本;
The distinction is useful when talking about webpack processes as they are occuring. As modules are chunked together, they can change significantly (especially during plugin processing), so it isn’t accurate to call them bundles at that point, the chunks may not even be emitted as bundles in the final output! Then after webpack is finished it is useful to have a term to refer to all of the emitted, final files (bundles).
译: 这样的区分对于描述webpack
的处理过程是有帮助的。由于多个module
被组合为一个chunk
,他们能够有效地改变(尤其是在插件处理过程中),所以这个时间节点把它们称为bundle
并不准确,而且这些chunks
可能不会称为最终输出中的bundles
!当webpack
处理结束后,有必要使用一个术语去表示它的最终输出文件(bundles
)
析: 这里应该是——所以这个时间节点把它们称为module
并不准确;module
通常是与源码相关的,webpack
将多个module
合并为一个chunk
,然后进行统一处理有助于提高效率,比如统一进行babel
转义等插件操作,所以webpack
处理过程中使用了术语chunk
表示这些文件;由于不是所有的chunks
都会成为最终的输出文件,所以又定义了一个新的术语——bundle
。