我的文件夹结构如下:
root
|
|- app
|
|- feature1
| |
| |- feature1.component.ts
| |- feature1.component.html
|- feature2
|- feature3
我的应用程序在运行" npm start"。
时有效我正在关注如何执行此操作的官方文档(https://angular.io/docs/ts/latest/cookbook/aot-compiler.html),但ngc似乎对此文件夹结构感到困惑。
运行" node_modules / .bin / ngc -p tsconfig-aot.json"时出现此错误:
Error: Compilation failed. Resource file not found: /mnt/intenso/code/my-angular2/app/dashboard/app/dashbo ard/dashboard.component.html
at Object.get (/mnt/intenso/code/my-angular2/node_modules/@angular/compiler-cli/src/codegen.js:71:27)
at DirectiveNormalizer._fetch (/mnt/intenso/code/my-angular2/node_modules/@angular/compiler/bundles/co mpiler.umd.js:13661:45)
at DirectiveNormalizer.normalizeTemplateAsync (/mnt/intenso/code/my-angular2/node_modules/@angular/com piler/bundles/compiler.umd.js:13704:23)
at DirectiveNormalizer.normalizeDirective (/mnt/intenso/code/my-angular2/node_modules/@angular/compile r/bundles/compiler.umd.js:13679:46)
at /mnt/intenso/code/my-angular2/node_modules/@angular/compiler/bundles/compiler.umd.js:13142:139
at Array.map (native)
at /mnt/intenso/code/my-angular2/node_modules/@angular/compiler/bundles/compiler.umd.js:13142:80
at Array.map (native)
at OfflineCompiler._compileSrcFile (/mnt/intenso/code/my-angular2/node_modules/@angular/compiler/bundl es/compiler.umd.js:13132:31)
at /mnt/intenso/code/my-angular2/node_modules/@angular/compiler/bundles/compiler.umd.js:13116:72
Compilation failed
似乎它希望我的所有功能#文件夹都不存在,并且具有完全平坦的结构 - 我想避免的。我如何实现这一目标?
我的tsconfig-aot.json:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"app/app.module.ts",
"app/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}