安裝了的WebPack的AOT插件(https://www.npmjs.com/package/@ngtools/webpack)後,dynamic requires
不再起作用:AOT +的WebPack + JSON動態需要
// Example that used to work
public getJson<T>(fileName: String): T {
return require(`../../${fileName}_${this.lang}.json`);
}
隨着標準ts-loader
或awesome-typescript-loader
等,dynamic requires
工作,的WebPack捆綁json
文件到主要app
捆綁。但是,使用AoT/Webpack插件時,json文件根本就沒有捆綁。我甚至覺得aot loader
不再重複json文件。
任何想法如何讓這個工作再次?謝謝。
信息:
https://github.com/angular/angular-cli/issues/3306
https://github.com/angular/angular-cli/pull/4153
更新:
作品有些與SystemJS -> System.import()
但不穩定 https://github.com/angular/angular-cli/issues/6629#issuecomment-336411537