File tree 1 file changed +21
-3
lines changed
1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,28 @@ ng build --base-href /myUrl/
59
59
ng build --bh /myUrl/
60
60
```
61
61
62
- ### Bundling
62
+ ### Bundling & Tree-Shaking
63
63
64
- All builds make use of bundling, and using the ` --prod ` flag in ` ng build --prod `
65
- or ` ng serve --prod ` will also make use of uglifying and tree-shaking functionality.
64
+ All builds make use of bundling and limited tree-shaking, while ` --prod ` builds also run limited
65
+ dead code elimination via UglifyJS.
66
+
67
+ ### ` --dev ` vs ` --prod ` builds
68
+
69
+ Both ` --dev ` /` --target=development ` and ` --prod ` /` --target=production ` are 'meta' flags, that set other flags.
70
+ If you do not specify either you will get the ` --dev ` defaults.
71
+
72
+ Flag | ` --dev ` | ` --prod `
73
+ --- | --- | ---
74
+ ` --aot ` | ` false ` | ` true `
75
+ ` --environment ` | ` dev ` | ` prod `
76
+ ` --output-hashing ` | ` media ` | ` all `
77
+ ` --sourcemaps ` | ` true ` | ` false `
78
+ ` --extract-css ` | ` false ` | ` true `
79
+
80
+ ` --prod ` also sets the following non-flaggable settings:
81
+ - Adds service worker if configured in ` .angular-cli.json ` .
82
+ - Replaces ` process.env.NODE_ENV ` in modules with the ` production ` value (this is needed for some libraries, like react).
83
+ - Runs UglifyJS on the code.
66
84
67
85
## Options
68
86
<details >
You can’t perform that action at this time.
0 commit comments