不编译更改的文件

不编译更改的文件

本文介绍了webpack --watch 不编译更改的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试运行 webpack --watch 并且在编辑我的 JS 文件后,它不会触发自动重新编译.

I tried running webpack --watch and after editing my JS files, it doesn't trigger an auto-recompilation.

我已经尝试使用 npm uninstall 重新安装 webpack 但它仍然无法正常工作.

I've tried reinstalling webpack using npm uninstall but it's still not working.

有什么想法吗?

推荐答案

仅供参考:似乎 OS X 的文件夹可能损坏并且不再发送 fsevents(其中 watchpack/chokidar/Finder 使用)本身和任何子文件夹.我不能确定这是发生在你身上的事情,但这对我和我的一位同事来说非常令人沮丧.

FYI: it seems OS X can have a folder get corrupted and no longer send fsevents (which watchpack/chokidar/Finder uses) for itself and any child folders. I can't be sure this is what happened to you, but it was very frustrating for me and a colleague.

我们能够重命名损坏的父文件夹,然后按预期立即观察事件.有关详细信息,请参阅此博客文章:http://livereload.com/troubleshooting/os-x-fsevents-bug-may-prevent-monitoring-of-certain-folders/

We were able to rename the corrupt parent folder and then watch events immediately came through as expected. See this blog post for more info: http://livereload.com/troubleshooting/os-x-fsevents-bug-may-prevent-monitoring-of-certain-folders/

以上链接中推荐的修复方法是:

The recommended fixes from the above link are:

  • 重新启动计算机
  • 通过磁盘工具检查磁盘并修复权限
  • 将文件夹添加到 Spotlight 隐私列表(未索引的文件夹列表),然后从中删除,有效地强制重新索引
  • 重命名文件夹,然后可能将其重命名
  • 重新创建文件夹并将旧内容移回其中

前两个对我们不起作用,没有尝试 Spotlight 的建议,重新创建也没有必要.

First two did not work for us, didn't try the Spotlight suggestion, and the re-creation did not prove necessary.

我们能够通过打开 Finder 并在每个连续的父文件夹中创建文件直到立即出现一个文件来找到根本问题文件夹(因为 Finder 也会被这个错误感染).不更新的最根目录文件夹是罪魁祸首.我们只是将它 mvmv 恢复到原来的名字,然后观察者工作了.

We were able to find the root problem folder by opening Finder and creating files in each successive parent folder until one showed up immediately (since Finder will get hosed by this bug as well). The root-most folder that does not update is the culprit. We just mv'd it and mv'd it back to its original name, and then the watcher worked.

不知道是什么导致了损坏,但我很高兴有一个修复.

No idea what causes the corruption, but I'm just glad to have a fix.

这篇关于webpack --watch 不编译更改的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 05:55