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

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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raphaël Balet