From 6d08b1052ab23747056bce777b974d21cdd8683b Mon Sep 17 00:00:00 2001 From: Stian Standahl Date: Fri, 3 Mar 2017 10:41:21 +0100 Subject: [PATCH 1/2] docs(@ngtools/webpack): added warning, example and table of differences when building with prod --- docs/documentation/build.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/documentation/build.md b/docs/documentation/build.md index fdf4a7335883..6b20c8225266 100644 --- a/docs/documentation/build.md +++ b/docs/documentation/build.md @@ -64,6 +64,30 @@ ng build --bh /myUrl/ 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. +**Note:** It is not recommended using `[class].constructor.name` while using the +`--prod` build flag. Since the name of the class will be uglified. +#### Example +```js +// Outputing router events to log +router.events.map(event => console.log(event.constructor.name)); + +// Output without --prod flag: +// NavigationStart +// RoutesRecognized +// NavigationEnd + +// With --prod flag: +// t +// v +// c +``` + +#### Difference between building with or without `---prod` flag +| | With | Without | +|--------------|:----:|:-------:| +| Tree-shaking | x | x | +| Uglifying | x | | + ## Options `--watch` (`-w`) rebuild when files change From 7a7d2ec059a0c58fd687c3be76049d008cc2e18b Mon Sep 17 00:00:00 2001 From: stiasta Date: Tue, 7 Mar 2017 08:21:30 +0100 Subject: [PATCH 2/2] docs(@ngtools/webpack): mentioning the default functionality --- docs/documentation/build.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/documentation/build.md b/docs/documentation/build.md index 1d6e76ead39b..8fa4b06170b3 100644 --- a/docs/documentation/build.md +++ b/docs/documentation/build.md @@ -83,11 +83,15 @@ router.events.map(event => console.log(event.constructor.name)); ``` #### Difference between building with or without `---prod` flag +The functionality that does not have * after it, are by default added to the workflow. + | | With | Without | |--------------|:----:|:-------:| -| Tree-shaking | x | x | +| Tree-shaking | x | x* | | Uglifying | x | | +*The flag must specifically be added. + ## Options `--aot` Build using Ahead of Time compilation. @@ -131,4 +135,4 @@ router.events.map(event => console.log(event.constructor.name)); `--verbose` (`-v`) Adds more details to output logging. -`--watch` (`-w`) Run build when files change. \ No newline at end of file +`--watch` (`-w`) Run build when files change.