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

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

问题描述

我正在为我的 angular 项目中的一个问题寻找解决方案,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 开发服务器不会检测到来自主机环境的文件更改.(例如:每当 docker 开发环境在 Windows 主机上运行时.)这是通过在 webpack 开发服务器配置中添加 poll 选项来解决的.默认情况下,当没有设置轮询间隔时,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.

Ref: JSMike 对 feat(webpackDevServer) 的评论:添加 watchOptions角度的 webpackDevServer/角cli |GitHub

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

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