Skip to content

Commit f0ecd02

Browse files
author
Stian Standahl
committed
added section on difference between building with or without prod flag
1 parent 214be99 commit f0ecd02

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/documentation/build.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ ng build --bh /myUrl/
6464
All builds make use of bundling, and using the `--prod` flag in `ng build --prod`
6565
or `ng serve --prod` will also make use of uglifying and tree-shaking functionality.
6666

67+
**Note:** It is not recommended using `[class].constructor.name` while using the
68+
`--prod` build flag. Since the name of the class will be uglified.
69+
#### Example
70+
```js
71+
// Outputing router events to log
72+
router.events.map(event => console.log(event.constructor.name));
73+
74+
// Output without --prod flag:
75+
// NavigationStart
76+
// RoutesRecognized
77+
// NavigationEnd
78+
79+
// With --prod flag:
80+
// t
81+
// v
82+
// c
83+
```
84+
85+
#### Difference between building with or without `---prod` flag
86+
| | With | Without |
87+
|--------------|:----:|:-------:|
88+
| Tree-shaking | x | x |
89+
| Uglifying | x | |
90+
6791
## Options
6892
`--watch` (`-w`) rebuild when files change
6993

0 commit comments

Comments
 (0)