从Webpack文档(
https://webpack.github.io/docs/api-in-modules.html#require-ensure):
Download additional dependencies on demand. The dependencies array lists modules that should be available. When they are,callback is called. If the callback is a function expression,dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server,except if all modules are already available.
如果源部分中的依赖项也是按需提取和加载的,那么为什么还要在依赖项列表中添加任何内容呢?
我见过这样的例子很混乱(https://github.com/webpack/webpack/tree/master/examples/extra-async-chunk):
require.ensure(["./a"],function(require) { require("./b"); require("./d"); });
“b”和“d”不在依赖项列表中,但将按需加载,就像“a”一样.那有什么区别?