4

I have an existing angular.js application, which I am in the process of upgrading to angular with NgUpgrade. I am also trying to move to using angular cli as the build system. ng serve and ng build works perfectly, but I am having trouble with ng build -prod.

For the orginal application, I used gulp for building, and as a intermediate step i transformed the input files with ng-annotate. I am having a hard time getting this to work with angular cli.

Is there any way to integrate ng-annotate with ng build -prod? Or any other way to process the angular.js files before minification?

larlon
  • 557
  • 1
  • 6
  • 17

1 Answers1

0

I did this using babel-plugin-angularjs-annotate, which adds the annotations to the source files, in a permanent manner (so, you only need to run it once).

I put detailed instructions in this other SO post.

Notice Babel should not be added to your Angular project. Instead, you create a second project, and execute Babel in there. Babel will read the files from the folder you specify, and generate the annotated files in another folder you specify.

After you run this once, you can forget about ng-annotate.

Daniel
  • 21,933
  • 14
  • 72
  • 101