-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite reload with CopyWebpackPlugin #4232
Comments
Can you provide |
I updated the description. What do you mean by macos ? |
Can you reproduce the problem using given example of repo? I can't, maybe you can record video/screenshots? |
That's weird, I reproduced the problem with the repo I gave you. I recorded my screen to show you (sorry I had to split if not the file was too big): webpack_1.mp4webpack_2.mp4webpack_3.mp4webpack_4.mp4 |
Can you try to reproduce it without VS code (using any editor)? |
I tried with powershell to run the command and Notepad++ to edit the file and at the end I had the same infinite reload. |
hm, sorry, I can't help, I don't even reproduce try try to debug and look that is file raise change event |
Yes sure no problem ;) |
I think no, problems somewhere else |
I am experiencing same issue. Only for me dev server goes into infinite compile loop right after starting it up. When I disable CopyWebpackPlugin, there is no infinite loop. Environment: Installed packages:
devServer config:
I can provide a testing repo if you can fire up an external server in your environment providing the PHP app at mydomain.localhost. Please let me know. UPDATE
to the devServer config, no more infinite loop. |
In my case, adding this property does not fix it :/ |
@alexander-akait. Is there a way to know which file makes the reload ? |
@PierBJX hm, you should see this in console https://github.com/webpack/webpack-dev-server/blob/master/client-src/index.js#L225 |
@alexander-akait
What is weird is that it goes to |
@gebeer Do you have copy plugin? And how you use |
@alexander-akait , gebeer succeeded to fix it by adding |
Thanks for the offer. I solved it, like @PierBJX wrote. Yes, I am using copy plugin. But, when I use my machines IP instead of 'localhost' to make the app available in local network, then the reload loop is back again. So it might be something related to the http-proxy-middleware package. This is just a guess. Didn't find the time to look deeper into it. |
It sounds weird if it is related to localhost. Indeed, even when I do not open the page in the browser, I can have the reload in the command line. Like in the video. |
@PierBJX Sorry for delay (I got Covid), if you disable copy plugin do you have infinity reload? Copy plugin get base from glob (i.e. |
@alexander-akait No problem :) If I disable copy plugin I do not have infinite reload anymore. And an additional interesting thing is when I run with WSL2 my project, I do not have infinite reload anymore. It seems related to windows. |
@PierBJX Yeah, WSL2 has some bugs with |
@alexander-akait In fact, it is the contrary. Using, WSL2 I do not have the issue. However, on Windows I do have the problem. |
hm, sounds like it can be bug in WSL2, need debug, I already reported a lot of bugs in WSL (and they were fixed), but debugging them is not easy |
Minimum - can you debug file which cause reload? Just put console.log inside hooks |
@alexander-akait In fact, I do NOT have bug in WSL 2. If nodejs is installed on WSL2 and I use it => no issue. But if I use nodejs from windows I have the infinite reload. You can see previous comments with video I attached |
@PierBJX hm, very strange, maybe you can try to create reproducible test repo, I really want to investigate it, you can write me in twitter/telegram directly and do not publish it here, I can sign NDA if you need it |
@alexander-akait I already provide a reproductible test repo in the description of the issue. But if you want to investigate a bit deeper, we can talk on twitter ;) |
@PierBJX as I can see it happens not on first change, after multiple, right? |
@alexander-akait In the reproductible repo yes. But with my private project it occurs at the first or second times most of the time (the project is bigger). |
Not sure if it helps anyone else, but I had a similar issue where webpack was endlessly recompiling in dev. Finding this ticket clued me into the issue: new CopyWebpackPlugin({
patterns: [
{
from: "manifest*.xml",
to: "[name]" + "[ext]",
transform(content) {
if (dev) {
return content;
} else {
return content.toString().replace(new RegExp(urlDev, "g"), url);
}
},
},
] In my case, the rule wasn't needed anyway. Taking it out fixed my endless loop. This was a Microsoft Word Task Pane React add-in that was generated using yeoman. I think the issue had something to do with trying to run webpack watch while also running a node server on localhost:3000 but I never did figure it out. |
For what it's worth, I'm NOT using the I feel like that points to this not being an issue with My issue was it was only happening when launching from VSCode:
When I brought up the localhost URL in my normal Chrome browsing window it was no problem. Hopefully this helps someone.
|
Bug report
Webpack dev server reloads infinitely after changes in the src code when I use
CopyWebpackPlugin
withrequirejs
such like that:Here are the versions I have:
Actual Behavior
When I run the command:
webpack serve
and I modify the code.Webpack recompiles but after it is written
compiled successfully
, it recompiles again and again...Expected Behavior
I should recompile only once after change done in the src code.
How Do We Reproduce?
You can find here a repo to reproduce it.
webpack serve
example.js
) and savePlease paste the results of
npx webpack-cli info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: