来自:https://angular.io/docs/ts/latest/cookbook/aot-compiler.html
用ngc编译我的项目后,我一直在开始使用404
404 GET /aot/app/app.module.ngfactory
如果我尝试在浏览器中访问资源,那么
200 GET /aot/app/app.module.ngfactory.js
我不明白为什么角度没有添加" .js"在此扩展
详细信息:
我修改了我的main.ts:
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
我用ngc编译:
node_modules\.bin\ngc -p tsconfig-aot.json
tsconfig-aot.json:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"app/app.module.ts",
"app/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
感谢