CLI中--poll标志的作用是什么 [英] What is the function of --poll flag in CLI

查看:70
本文介绍了CLI中--poll标志的作用是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找解决方案来解决我的角度项目中的问题,ng serve --watch未检测到某些文件中的更改.

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.

然后我得到一个解决方案,说使用--poll=2000

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

它确实有效.

但是没有关于标志 poll 的功能的明确信息.

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

推荐答案

如果Angular CLI在Windows主机上的linux VM的共享目录中运行,则webpack开发服务器不会检测到主机环境中的文件更改. (例如:每当Windows主机上运行docker dev环境时.) 通过将轮询选项添加到webpack开发服务器配置中,可以解决此问题.默认情况下,当未设置轮询间隔时,watchpack将使用本机文件系统更改检测.此更改允许设置轮询间隔,该间隔将打开轮询.

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.

参考: https://github.com/angular/angular- cli/pull/1814#issuecomment-241854816

这篇关于CLI中--poll标志的作用是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆