15

I was searching a solution for an issue which is in my angular project, ng serve --watch was not detecting changes in some of the files.

And I got a solution which says use --poll=2000

It really worked.

But there are no clear information available about the function of flag poll.

Debojyoti
  • 4,503
  • 3
  • 19
  • 27

2 Answers2

24

In cases where Angular CLI is running in a shared directory on linux VM on a windows host the webpack dev server isn't detecting file changes from the host environment. (ex: Whenever a docker dev environment is running on a windows host.) This is solved by adding poll option to the webpack dev server configuration. By default when no poll interval is set watchpack will use native file system change detection. This change allows for setting the poll interval which will turn on polling.

Ref: Comment by JSMike on feat(webpackDevServer): Add watchOptions for webpackDevServer in angular / angular-cli | GitHub

Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
4

The correct usage is --poll ms and not --poll = ms.
For example:

ng serve --poll 2000
Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
P Sh
  • 41
  • 2