I'm trying to use AOT compiler in this angular 2 project. I get error: TypeError: this.compiler.compileModules
is not a function when I execute command: "node_modules/.bin/ngc" -p tsconfig-aot.json
.
How to solve this issue?
Steps to reproduce:
clone this repo: https://github.com/AngularClass/angular2-webpack-starter
install compiler-cli (version 2.1.2): npm install @angular/compiler-cli --save
remove
src/app/+detail
directory anddetail
router fromsrc/app/app.routes.ts
(I did it because"node_modules/.bin/ngc" -p tsconfig-aot.json
outputs error:can't resolve module src/app/+detail/index.ts from src/app/+detail/index.ts
)create
tsconfig-aot.json
:{ "compilerOptions": { "target": "es5", "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true },
"angularCompilerOptions": { "genDir": "aot", "skipMetadataEmit" : true } }run
"node_modules/.bin/ngc" -p tsconfig-aot.json