I don't want to use serve, I know it watches for changes, builds and serves. I want to build upon changes. According to "ng help", build takes parameter --watch
ng build Builds your app and places it into the output path (dist/ by default). --watch (Boolean) (Default: false) aliases: -w --watcher (String)
I tried both -w and --watcher but it just gives error.
>ng build -w Path must be a string. Received null
Syntax. ng build command compiles an angular application/library into an output directory named dist at given path.
You may use the watch option on Angular build for updating the output as and when developers make changes to the code. It is very similar to serve, except that the application runs a different web server from the default dev server.
The ng new command creates an Angular workspace folder and generates a new application skeleton. A workspace can contain multiple applications and libraries. The initial application created by the ng new command is at the top level of the workspace.
I don´t know if it´s a bug or just not documented, but it seems that you need to add a output path for watching with ng build -o dist -w
while dist is your output path.
Update:
The command is now: ng build -op dist -w
Update 2:
The command is now: ng build --output-path dist --watch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With