Skip to content

Commit 67ada7e

Browse files
committed
docs: add dev vs prod details
Fix #5315
1 parent 1cd0a08 commit 67ada7e

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

docs/documentation/build.md

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

62-
### Bundling
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.
62+
### Bundling & Tree-Shaking
63+
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+
`--dev`:
73+
- `--aot` is set to `false`.
74+
- `--environment` is set to `dev`.
75+
- `--output-hashing` is set to `media`.
76+
- `--sourcemaps` is set to `true`.
77+
- `--extract-css` is set to `false`.
78+
79+
`--prod`:
80+
- `--aot` is set to `true`.
81+
- `--environment` is set to `prod`.
82+
- `--output-hashing` is set to `all`.
83+
- `--sourcemaps` is set to `false`.
84+
- `--extract-css` is set to `true`.
85+
86+
`--prod` also sets these non-flaggable settings:
87+
- Adds service worker if configured in `.angular-cli.json`.
88+
- Replaces `process.env.NODE_ENV` in modules with the `production` value (this is needed for some libraries, like react).
89+
- Runs UglifyJS on the code.
6690

6791
## Options
6892
<details>

0 commit comments

Comments
 (0)