我正在使用angularpack 4與webpack 2 &試圖使用AOT,但它給了我這個錯誤:10% building modules 4/5 modules 1 active ..._modules/intl/locale-data/jsonp/en.jsModuleNotFoundError: Module not found: Error: Can't resolve './../$$_gendir/src/app/app.module.ngfactory' in '/Users/xyz/angular-upgrade/backend/myapp/angular/src'
。Angular 4 AOT with webpack
這是我的webpack.config
:
new AotPlugin({
tsConfigPath: './tsconfig.json',
entryModule: './src/app/app.module#AppModule'
}),
,我使用,使生成的腳本是:"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail"
下面是我的tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules",
"bower_components"
]
}
這些'ngfactory'文件應該已經自動創建執行構建過程中鏈 - 這將是AOT的結果。也許在https://angular.io/docs/ts/latest/cookbook/aot-compiler.html查看並查看你的構建命令和配置是否正確(搜索'ngc') –
我認爲我不需要ngc在這裏,因爲我使用'@ ngtools/webpack' –