From 83b5f27e45c079c2b983dbc7a35ea8ede935097e Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 9 May 2017 09:54:59 +0100 Subject: [PATCH] docs: add dev vs prod details Fix #5315 --- docs/documentation/build.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/documentation/build.md b/docs/documentation/build.md index 4c1bcc1b270b..886123dcad94 100644 --- a/docs/documentation/build.md +++ b/docs/documentation/build.md @@ -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