webpack / webpack/webpack-dev-server
Infinite reload with CopyWebpackPlugin
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 1.5k
- Avg merge
- 5h 32m
- Merged PRs (30d)
- 6
Description
Bug report
Webpack dev server reloads infinitely after changes in the src code when I use CopyWebpackPlugin with requirejs such like that:
new CopyPlugin({
patterns: [
{
from: 'requirejs/**/*',
to: '3rdparty',
context: '../../node_modules',
},
],
}),
Here are the versions I have:
"copy-webpack-plugin": "^10.2.0",
"webpack": "^5.64.4",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.2"
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.
- Run
webpack serve - Change the src code (
example.js) and save - You have to try several times in a row to change the code, generally it does not happen the first time but after several changes (last time I had to change 10 times the src code to reproduce the infinite reload)
Please paste the results of npx webpack-cli info here, and mention other relevant information
System:
OS: Windows 10 10.0.19044
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 12.98 GB / 31.73 GB
Binaries:
Node: 14.17.5 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.2.0 - ~\AppData\Roaming\npm\npm.CMD
Browsers:
Chrome: 97.0.4692.99
Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.76)
Internet Explorer: 11.0.19041.1202
Packages:
copy-webpack-plugin: ^7.0.0 => 7.0.0
fork-ts-checker-webpack-plugin: ^6.5.0 => 6.5.0
html-webpack-plugin: ^5.5.0 => 5.5.0
raw-loader: ^4.0.2 => 4.0.2
ts-loader: ^9.2.6 => 9.2.6
webpack: ^5.64.4 => 5.64.4
webpack-cli: ^4.9.1 => 4.9.1
webpack-dev-server: ^4.7.2 => 4.7.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository and run webpack serve using the shown CopyPlugin pattern. Edit and save example.js repeatedly, then trace the webpack-dev-server watch and reload behavior to identify why recompilation repeats. Done means a source change causes one recompilation rather than an infinite reload loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100