Angular - Difference between "optimization" and "buildOptimizer" in the build config (angular.json)

Viewed 12593

Can someone explain me exactly the difference between those two flags (optimization and buildOptimizer) defined in the build config angular.json during the build process when I execute ng build? The official build documentation isn't clear to me.

1 Answers

buildOptimizer optimizes the transpilation of TS to JS (remove unused code, add tslib,..) More detailed explanation in the readme of the package https://www.npmjs.com/package/@angular-devkit/build-optimizer

optimization flag I think this one indicates the execution of some Webpack plugins. As in what to do with the JS after the buildOptimizer.

More about optimization flag here

Related