yashodha_h
yashodha_h

Reputation: 1004

angular 2 AOT compilation

I want to compile my angular 2 projects with AOT.

ng build --prod --aot

gives this error;

ERROR in Unexpected value 'null' imported by the module 'AppModule in D:/Git/ng_v4_aot/src/app/app.module.ts'

Are there any initial configurations before compiling with AOT?

Upvotes: 1

Views: 198

Answers (1)

macrog
macrog

Reputation: 2105

install npm install rollup rollup-plugin-node-resolve rollup-plugin-commonjs rollup-plugin-uglify --save-dev

  1. ng build // build with JIT
  2. ng build --prod --no-aot // build with JIT
  3. ng build --prod // build with AOT

Since @angular/[email protected] they've made the AOT compilation the default for production builds.

Create a tsconfig-aot.json as descirbed in aot documentation

Run the following command:

  • "node_modules/.bin/ngc" -p tsconfig-aot.json (will build and output ngFactory files)
  • ng build --prod

Upvotes: 1

Related Questions