Skip to content

docs: add dev vs prod details #6232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions docs/documentation/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,28 @@ ng build --base-href /myUrl/
ng build --bh /myUrl/
```

### Bundling
### Bundling & Tree-Shaking

All builds make use of bundling, and using the `--prod` flag in `ng build --prod`
or `ng serve --prod` will also make use of uglifying and tree-shaking functionality.
All builds make use of bundling and limited tree-shaking, while `--prod` builds also run limited
dead code elimination via UglifyJS.

### `--dev` vs `--prod` builds

Both `--dev`/`--target=development` and `--prod`/`--target=production` are 'meta' flags, that set other flags.
If you do not specify either you will get the `--dev` defaults.

Flag | `--dev` | `--prod`
--- | --- | ---
`--aot` | `false` | `true`
`--environment` | `dev` | `prod`
`--output-hashing` | `media` | `all`
`--sourcemaps` | `true` | `false`
`--extract-css` | `false` | `true`

`--prod` also sets the following non-flaggable settings:
- Adds service worker if configured in `.angular-cli.json`.
- Replaces `process.env.NODE_ENV` in modules with the `production` value (this is needed for some libraries, like react).
- Runs UglifyJS on the code.

## Options
<details>
Expand Down