Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

javascript - Why is webpack --watch not updating when specific files are updated

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.

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.

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.

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

plugins: [
    new webpack.OldWatchingPlugin()
],

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...