为什么webpack --watch在更新特定文件时不会更新 [英] Why is webpack --watch not updating when specific files are updated

查看:107
本文介绍了为什么webpack --watch在更新特定文件时不会更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个体面的大小的webpack应用程序,它被大量组织成特定的段。使用纯javascript和jsx文件时,一切都很好用,因为每当我更新任何内容时,它都会逐步重建捆绑包。

I have a decent sized webpack application that's heavily organized into particular segments. Everything works great with both pure javascript and jsx files, as anytime I update anything it incrementally rebuilds the bundle.

我现在在同一个根目录中添加了一个新文件夹我的其他人,并在其中创建了一个新的JavaScript文件。 Webpack也知道它,因为它包含了包中的代码,并且只要它看到其他文件之一被更改,它就会正确地重建所有更改,包括在我的新javascript文件中。

I have now added a new folder in the same root as all my others, and created a new javascript file in it. Webpack knows too look for it because it is including the code in the bundle, and anytime it sees that one of the other files is changed it correctly rebuilds all changes, including in my new javascript file.

但是,出于某种原因,每当我保存对这个javascript文件的更改时,webpack都不会检测到它需要从中重新加载更改。因此,如果我所做的唯一更改是在这个javascript文件中,则不会创建新的包,我必须 ctrl + c 并重新运行webpack。

However, for some reason whenever I save a change to this one javascript file, webpack does not detect that it needs to reload the changes from it. Therefore, if the only changes I make are in this one javascript file a new bundle won't be created and I have to ctrl+c and re-run webpack.

我已经尝试重命名文件夹,重命名javascript文件,以及其他几个无法帮助解决问题的步骤。

I've tried renaming the folder, renaming the javascript file, and several other steps that did nothing to help the situation.

任何人都可以对可能发生的事情有所了解,或者有什么方法可以获得有关webpack看到或未看到的更多信息?

Can anyone give any insight into what may be going on, or is there any way I can get more information about what webpack is seeing or not seeing?

推荐答案

使用旧的观察者插件似乎解决了我的需求问题。通过以下方式完成我的配置:

using the old watcher plugin seems to resolve the issue for my needs. Done in my configuration via:

plugins: [
    new webpack.OldWatchingPlugin()
],

这篇关于为什么webpack --watch在更新特定文件时不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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