The problem in doing so, is that ng serve starts reloading as soon as ng build starts recompiling, so after each file change it refreshes the browser ~3 times and often doesn't show the new changes in the browser window until a 4th (manual) refresh.
Asked
Active
Viewed 452 times
1
-
are you using 'serve' and 'build' both simultaneously ? – YogendraR Jan 07 '20 at 10:39
-
yes I'm running the build for all my library packages and then at the same time i'm running the serve for the demo app – Robbert Wolfs Jan 07 '20 at 10:42
-
May I know why you would need to run both commands simultaneously? – Aravind Sai Vellappat Jan 07 '20 at 11:20
-
why so, what is your use case ? – YogendraR Jan 07 '20 at 11:23
-
turn off autosave in vscode and disable cache in dev tools in browser – Wisely D Cruizer Jan 07 '20 at 11:38
-
We are developing components (ng build) and are using the demo app (ng serve) to use these components inside our (demo) app – Robbert Wolfs Jan 07 '20 at 12:27
-
@WiselyDCruizer I don't use vscode ;) – Robbert Wolfs Jan 07 '20 at 12:27
-
are these same app, could you elaborate little more ? – YogendraR Jan 07 '20 at 12:41
-
We are using a mono-repo, containing multiple components and a demo like : ` - demo - packages - component1 - component2 ` And we are running `ng build` for each component and `ng serve` for our demo app – Robbert Wolfs Jan 07 '20 at 12:55
-
hmmm formatting is not as it should :( – Robbert Wolfs Jan 07 '20 at 12:57
-
could you create a minimal git repo for demo purpose ? and steps you are using to run your app. – YogendraR Jan 07 '20 at 13:20
1 Answers
-1
You can use just this command : ng serve --aot
it contains ng serve and ng build inside

Mostafa Saadatnia
- 802
- 8
- 20
-
No, --aot is just a ahead of time compilation flag, it doesn't generate deployable files – YogendraR Jan 07 '20 at 11:26
-
before leaving a negative point, please make sure what is the F... question. thank you. – Mostafa Saadatnia Jan 07 '20 at 12:23