Angular-cli: ng serve --poll

Created on 1 May 2018  路  12Comments  路  Source: angular/angular-cli

Was the --poll flag removed in v6, or is that just an error in the newly committed docs? As per https://github.com/angular/angular-cli/issues/5212 it's needed to support Docker on Windows, which is still the case as far as I'm aware.

2 (required)

Most helpful comment

Yeap, it should be on the next release of @angular-devkit/build-angular!

All 12 comments

@buu700 it's still there, but it is a build option and not a serve option. If you add it to projects.project-name.architect.build.options.poll it should work. I tried it on a new project modifying templates and ts files with a 10000ms poll and saw rebuilds.

Got it, thanks! It'd be easier to use as a command line flag since our serve script conditionally adds it based on whether the host OS is Windows, but not a blocker since copying and transforming angular.json is an option too.

You can create a configuration that contains poll, and conditionally use that:

```
"build": {
...
"configurations": {
"docker": {
"poll": 2000
````

Then use that one on serve. WDYT? Or maybe poll should be on serve as well, as we do have some duplicated options there.

Ah, that could possibly work. Would I be able to stack that with another configuration, like --configuration beta --configuration docker (as I understand, --configuration now replaces --environment?), or would I need to make two different versions of beta in this case?

We're adding it to dev-server on https://github.com/angular/devkit/pull/822, but I would like to mention that configuration extensibility/composability is on the radar. ATM there is neither.

Awesome, thanks! So that will add --poll back to the serve command?

Yeap, it should be on the next release of @angular-devkit/build-angular!

poll option is still not available in @angular/[email protected] serve!

is there any other way to enable poll option?

The new option is better than the old: it takes an argument for the milliseconds time to wait between polls. (You can see this in the commit referenced above.) However, if you simply pass --poll it has no default so it appears as if it is not working...

ng serve --host 0.0.0.0 --poll 200

^ Works as expected in vagrant on win10 host

ng serve --host 0.0.0.0 --poll

^ Does no polling, so perhaps a sensible default should be added? 500 or 1000 ms?

I am new to this option, when do you use this poll.. can anybody help on atleast one usecase? where it helps.

Thank you

@rogusdev The next version (9.0) will default to 500ms if the poll option is provided without a value. https://github.com/angular/angular-cli/pull/15417

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings