我的应用程序在开发版本中运行得很好,但是我不能让AOT产品构建正常工作。对于每个延迟加载的模块,我得到如下错误:
ERROR in ./target/aot/src/main/webapp/app/app.module.ngfactory.ts
Module not found: Error: Can't resolve './features/about/about.module.ngfactory' in '/Users/Dan/work/a/gba/target/aot/src/main/webapp/app'
@ ./target/aot/src/main/webapp/app/app.module.ngfactory.ts 535:190-240
@ ./src/main/webapp/app/app.main-aot.ts像这样的一个:
ERROR in ./src/main/webapp/app/app.routing.ts
Module not found: Error: Can't resolve '../../../../target/aot/src/main/webapp/app/features/about/about.module.ngfactory' in '/Users/Dan/work/a/gba/src/main/webapp/app'
@ ./src/main/webapp/app/app.routing.ts 15:137-228
@ ./target/aot/src/main/webapp/app/app.module.ngfactory.ts
@ ./src/main/webapp/app/app.main-aot.ts路径似乎是正确的,但这些模块的文件并不存在。如果我急切地加载了一个延迟加载的模块,那么该模块的错误就会消失。
我听从角度路由器加载器的指示。我想我做得对,但运气不好
// webpack.prod.js
{ loader: 'angular-router-loader?aot=true&genDir=target/aot' }
// tsconfig-aot.json
"angularCompilerOptions": {
"genDir": "target/aot",
"skipMetadataEmit": true
}发布于 2017-08-06 11:21:19
我怀疑您的问题与您的tsconfig-aot.json有关,因为角的编译器会查看您传递给tsconfig的文件。
所以我的假设是:
tsconfig-aot.json
"files": [
"src/main/webapp/app/app.module.ts",
"src/main/webapp/app/app.main-aot.ts",
"src/main/webpapp/app/features/about/about.module.ts" <= try to add this
],https://stackoverflow.com/questions/45526122
复制相似问题