You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
webpack-dev-server goes into infinite compile loop after making the smallest change to the source code #4362
I have an issue when webpack-dev-server goes into infinite compile loop after any change to the source code.
The same code works without this issue for my colleague. And it doesn't go into infinite loop every time: sometimes it will compile only once and stop (so works as it should), but sometimes it goes into frenzy mode.
In the the verbose log attached on the first change it compiled only once and stopped, but after I did another change it went into infinite loop. webpack-dev-server.log
Symptoms:
When I make a change to the component - webpack-dev-server recompiles it, but doesn't stop after the first cycle and keeps doing it:
I've tried to play with webpack related libraries versions, npm and node versions, clearing all caches for gradle, maven, intellij. Modified webpack configuration files to exclude things from watched. Removed and cloned the repository. Generated a new appliation with JHipster and compared generated webpack configs with mine, tried to make different changes. Nothing helps.
This was, actually, how I noticed the issue: I was in the process of updating front-end libraries and migrated webpack-dev-server from v3 to v4. Later when testing it I found that it goes into infinite loop. At first I thought that something was wrong with my webpack configs and I modified them many times. Couldn't resolve it and after few days switched back to the previous version. But then I noticed that the issue still exists. After that I checked out few months old code from master branch, cleared all caches, removed all libraries, let npm and gradle to re-download all dependencies and even downgraded intellij version. It didn't help. The same source code works without issue for my colleague :(
I start thinking that it is not webpack related, but something on my pc intervenes and modifies the files and in this way triggers recompiling. Like antivirus, but I don't have any... Any ides what it can be?
Can you remove webpack.HotModuleReplacementPlugin, when you set hot: true, webpack-dev-server automatically apply this plugin, anyway can you provide example with code (no need to copy all code, only for showing the problem)
I don't know how could it work correctly for everyone else with just ignore because docs tell to use ignored. I also had to change regexp values in the array because it started complaining about them after I'd made a change. Maybe there are two different ways to ignore files and only one of them worked in my case.
I didn't have any validation errors neither now nor then. But I had to change regexps after switching from ignore to ignored. Should I have validation errors before the change or after it?
In v4 we moved this to static.watch which also has type: object only, we have not defined specific property because options are from chokidar which can change anytime and we will have to change them again in our schema.
Activity
alexander-akait commentedon Apr 1, 2022
Please firstly update webpack-dev-server to v4
OleksiL commentedon Apr 1, 2022
This was, actually, how I noticed the issue: I was in the process of updating front-end libraries and migrated webpack-dev-server from v3 to v4. Later when testing it I found that it goes into infinite loop. At first I thought that something was wrong with my webpack configs and I modified them many times. Couldn't resolve it and after few days switched back to the previous version. But then I noticed that the issue still exists. After that I checked out few months old code from master branch, cleared all caches, removed all libraries, let npm and gradle to re-download all dependencies and even downgraded intellij version. It didn't help. The same source code works without issue for my colleague :(
I start thinking that it is not webpack related, but something on my pc intervenes and modifies the files and in this way triggers recompiling. Like antivirus, but I don't have any... Any ides what it can be?
alexander-akait commentedon Apr 1, 2022
What is os? Please use the issue template in future, there are minimum questions which we need
OleksiL commentedon Apr 4, 2022
Windows 10. I scanned issue template, but maybe not thoroughly enough.
alexander-akait commentedon Apr 4, 2022
Can you remove
webpack.HotModuleReplacementPlugin, when you sethot: true, webpack-dev-server automatically apply this plugin, anyway can you provide example with code (no need to copy all code, only for showing the problem)OleksiL commentedon Apr 20, 2022
I've solved it by changing ending of one word:
ignore->ignored:I don't know how could it work correctly for everyone else with just
ignorebecause docs tell to useignored. I also had to change regexp values in the array because it started complaining about them after I'd made a change. Maybe there are two different ways to ignore files and only one of them worked in my case.alexander-akait commentedon Apr 20, 2022
Do you change this options in dev server options? Because we have validation, so you should get an error...
OleksiL commentedon Apr 21, 2022
Yes, in devServer options. I am using these versions of libraries:
Now it looks like this:
I didn't have any validation errors neither now nor then. But I had to change regexps after switching from
ignoretoignored. Should I have validation errors before the change or after it?alexander-akait commentedon Apr 21, 2022
Yes, it should be validation error, @snitin315 can you look at this?
snitin315 commentedon Apr 21, 2022
Yes. I will look into this.
snitin315 commentedon Apr 23, 2022
So, this config is for v3, in which we had
watchOptionsproperty withtype: objectonly, hence there was no error.webpack-dev-server/lib/options.json
Lines 417 to 420 in aa3cddc
In v4 we moved this to
static.watchwhich also hastype: objectonly, we have not defined specific property because options are fromchokidarwhich can change anytime and we will have to change them again in our schema.webpack-dev-server/lib/options.json
Lines 996 to 1014 in 7c1d680
snitin315 commentedon Apr 23, 2022
Similar is the case with other options as well which uses external API like
historyAPIFallback,bonjouretcalexander-akait commentedon Apr 24, 2022
We need to add
additionalProperties: false, let's do itmarekdedic commentedon Feb 9, 2023
Hi,
I'm getting this problem without having the
devServerkey in my config at all...The repo is skaut/shared-drive-mover
bogdan-panteleev commentedon May 9, 2023
Same for me. Just configured webpack as follows. And if I run
webpack --watch, then I have webpack recompiling the project endlessly.Eventually I just switched to ESBuild.
package.jsonwebpack.config.jssamir-kamble commentedon Jul 17, 2023
Did this stopped infinite loop problem ? Also, I did not see webpack.config.js file. I have webpack.custom.js file.
Do I need to create a file with that name?
samir-kamble commentedon Jul 17, 2023
Where do we need to add it?
vbansal2 commentedon Nov 1, 2023
is there any update on this issue?
OZZlE commentedon Jan 11, 2024
watchpack
I tried even setting watch to false and it still does it
alexander-akait commentedon Jan 11, 2024
There are a lot of different problems here, please provide reproducible test repo before ask a help, without it we can't help you
OZZlE commentedon Jan 12, 2024
package.json
webpack.config.dev.js
alexander-akait commentedon Feb 5, 2024
@OZZlE What are steps to reproduce the problem? I see you have
writeToDisk: trueandplease make sure you ignore generated webpack file, otherwise you can have a loop of reloading
alexander-akait commentedon Feb 8, 2024
The original problem was resolved. Anyway feel free to feedback