Since Angular 5 ang Angular CLI 1.5, Typescript files are no longer emitted on AOT compilation. Indeed, with Angular CLI 1.5, a new Webpack plugin arrived: AngularCompilerPlugin. This last is specially used when we compile an Angular 5+ application. Previously, we used another Webpack plugin: AOTPlugin. The consequence is that the compiler no longer uses the
genDir property and @ngtools/webpack keeps these intermediate files directly in memory. You can take a look at this discussion on Github for some explanations. So, with Angular CLI, there is no other output than the bundled files emit by Webpack.
Fortunately, we can retrieve your ngfactory, .metadata.json and .ngsummary.json and even more by an another way. The difference from Angular 4 to Angular 5 is that with Angular 4 the compiler only generated the extra code, i.e. ngfactory, ngsummary etc… but did not compile the developer's code. ngc generated these files in
gendir, and tsc generated the application files in
With Angular 5, the compiler will output the entire code in JS file in the
outDir folder specified in the compilerOptions section of your tsconfig.json.
You will understand, in order to generate your Angular factories, just launch the command:
at the root of your project.
If you want to generate declaration files .d.ts, you can do this by setting
declaration: true in the tsconfig.json file:
You get the following result:
Les derniers articles par William Koza (tout voir)
- Retrieve your ngfactory, .metadata.json and .ngsummary.json with Angular 5 - 8 avril 2018
- HttpClient, une refonte du module historique - 10 août 2017
- Angular 4.0 est arrivé ! - 22 mars 2017