UIライブラリとしてAngular Materialの代わりに普段使い慣れているPrimeNGを使っているが基本的には同じ。
PrimeNGのDialog
とTable
を依存関係に持ったコンポーネントapp-table-dialog
を、ダイアログを表示するボタンを初めて押したときに遅延ロードするサンプル。
# stats-json付きでビルドする
$ npm run build:stats
# webpack-bundle-analyzerを起動する
$ npm run analyze
↓webpack-bundle-analyzerの出力結果(遅延ロード対象のTableDialogComponentとその依存関係がmain.js外へと分割されている)