Question:
I wonder what the differences of build
production and build
development in Angular
?
Answer:
Development
ng build
Where
ng build --dev
- "maps" files are generated, files with the extension .js.map
- The code is not minified and ugliification
- It does not do a "Tree shaking", where the "dead code" is cleared
- There is no AOT compilation
Uses the configuration from the environment.ts file
Production
ng build --prod
- "maps" files are not generated, files with the extension .js.map
- The code is minified and ugliification
- Do a "Tree shaking", where the "dead code" is cleared
- There are AOT compilation
Uses the configuration from the environment.prod.ts file
Uglification – Puts short names for variables
Minified – Process of removing white spaces, comments and any unnecessary code for the machine to interpret
Tree shaking – Process to remove any code that has no use for the application
Sources
Angular Dev Build vs Prod Build
How to manage different environments with Angular CLI?