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

查看:35
本文介绍了为什么特定文件更新时 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?

推荐答案

使用旧的 watcher 插件似乎可以解决我需要的问题.通过以下方式在我的配置中完成:

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天全站免登陆