私は正しく非同期に読み込まれたチャンクの中に私たちのJSを適切に分割しようとしています。System.importでWebpack 2のコード分割:依存関係の依存性
私はいくつかのエントリポイントで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のを作るには、重複につながる、some-other-module
のチャンクでもmoment
が含まれます。
これは予期された動作ですか?もしそうなら、推奨される解決策は何ですか?