Romain Giraudeau
Romain Giraudeau

Reputation: 33

Which packages of angular are present in the final build

I would like to know if there is a tool to track packages that are present in the final build of an angular project.

For example : I have a package "@angular/compiler" which is a dependency of the package.json but not a dev dependency.

As mentioned on the angular docs https://angular.io/guide/aot-compiler#ahead-of-time-aot-compilation with AOT compiler code is already compiled, unlike JIT compiler. In my understanding, it means that the final build does not need @angular/compiler as a dependency if the flag AOT is set for the final build.

Is my reasoning is correct?

Upvotes: 2

Views: 539

Answers (1)

Tsvetan Ganev
Tsvetan Ganev

Reputation: 8856

You can see exactly what ends up in the production bundle by using a tool called webpack-bundle-analyzer.

  1. Build your Angular project with the --stats-json flag: ng build --prod --stats-json
  2. Run npx webpack-bundle-analyzer dist/{your-project-name}/stats.json which will open a browser window with an interactive chart displaying the included dependencies (you can even search for a specific module).

Upvotes: 3

Related Questions