I need to build 2 applications (New1 and New2) with watch option, so any files changes in any of those 2 apps lead to re-build.
ng build New1 && ng build New2
works fine, I can see both apps built under /dist directory,
but I cannot get ng build --watch
to work the same way. So far I tried:
1) ng build New1 && ng build New2 --watch
Builds both apps, but then only watches New2.
If I make changes to New1, the build doesn't happen again.
2) ng build New1 --watch && ng build New2 --watch
Only builds New1 app and watches it.
3) ng build New1 --output-path dist/New1 && ng build New2 --output-path dist/New2 --watch
Builds both apps, but then only watches New2.
4) ng build New1 --output-path dist/New1 --watch && ng build New2 --output-path dist/New2 --watch
Only builds New1 app and watches it.
Is there a way to use build --watch for 2 apps in one line at all?
Appreciate the suggestions.
Angular CLI: 6.2.4
Node: 10.11.0
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.8.4
@angular-devkit/core 0.8.4
@angular-devkit/schematics 0.8.4
@schematics/angular 0.8.4
@schematics/update 0.8.4
rxjs 6.2.2
typescript 2.9.2
If you're trying to run 2 calls at the same time, I'd suggest the concurrently
package:
https://www.npmjs.com/package/concurrently
It's pretty easy to combine calls. You would add a new script to package.json and combine 2 commands. Below has not been tested with your code so please read the docs:
"build:concurrent": "concurrently \"ng build New1 --watch\" \"ng build New2 --watch\"",
You would then run it in the terminal using npm run build:concurrent