1

My folder structure is as follows:

root
|
|- app
    |
    |- feature1
    |   |
    |   |- feature1.component.ts
    |   |- feature1.component.html
    |- feature2
    |- feature3

My app works when running "npm start".

I am following the official docs ( https://angular.io/docs/ts/latest/cookbook/aot-compiler.html ) on how to do this, but ngc seems to get confused by this folder structure.

I get this error when running "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

It seems like it expects all my feature# folders to not exist, and have a completely flat structure - something i would like to avoid. How do i achieve this?

My 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
 }
}
||||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.