Skip to content

Commit 80e23e5

Browse files
filipesilvadond2clouds
authored andcommitted
docs: add dev vs prod details
Fix angular#5315
1 parent 31bdeab commit 80e23e5

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

docs/documentation/build.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,28 @@ ng build --base-href /myUrl/
5959
ng build --bh /myUrl/
6060
```
6161

62-
### Bundling
62+
### Bundling & Tree-Shaking
6363

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.
6684

6785
## Options
6886
<details>

0 commit comments

Comments
 (0)