1
好吧,所以我正在正确分割我们的JS在一堆异步加载的块。Webpack 2代码分裂与System.import:依赖关系的依赖
我在几个入口点使用import
,那伟大工程:
module.exports = Promise.all([
import('moment'),
import('some-other-module')
]).then((deps) => {
let [moment, someOtherModule] = deps;
}
和其他地方:
module.exports = Promise.all([
import('moment'),
]).then((deps) => {
let [moment] = deps;
}
的WebPack成功创建moment
和some-other-module
单独的块,并加载文件异步需要的时候。
但是:
some-other-module
实际上需要moment
为好,使的WebPack包括moment
也some-other-module
的块,导致重复。
这是预期的行为?如果是这样,那么推荐的解决方案是什么?