开发者社区> 问答> 正文

Webpack中的file chunk module

看了一遍Webpack文档,对里面的名词有很大的疑惑;

单入口来说:--------其他的不懂,哈哈

file是什么?最终生成的单js文件?

chunk是什么?和module有什么关系?
Code Splitting

webpack has two types of dependencies in its dependency tree: sync and async. Async dependencies act as split points and form a new chunk. After the chunk tree is optimized, a file is emitted for each chunk.
这里的new chunk是指一个新的文件么,页面请求时返回new chunk?
a file for each chunk是指什么?一个chunk一个js文件?

Loaders
webpack can only process JavaScript natively, but loaders are used to transform other resources into JavaScript. By doing so, every resource forms a module.
every resource forms a module.每个资源形成一个模块,这个模块时一个chunk么,是一个单独的请求么?

希望大家帮助我这只迷途的小羊……

展开
收起
a123456678 2016-03-11 16:25:01 3185 0
1 条回答
写回答
取消 提交回答
  • chunk 就是若干 module 打成的包,一个 chunk 应该包括多个 module,一般来说最终会形成一个 file。
    而 js 以外的资源,webpack 会通过各种 loader 转化成一个 module,这个模块会被打包到某个 chunk 中,并不会形成一个单独的 chunk

    2019-07-17 18:59:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
基于webpack和npm的前端组件化实践 立即下载
SPARKLER,A web-crawler on Apache Spark 立即下载
How to Build a Successful Data 立即下载