Dev server compiles twice in VSCode
See original GitHub issueBug report
What is the current behavior?
webpack-dev-server
(via webpack serve
) compiles twice on every save in VSCode. This doesn’t happen when using an other editor such as Sublime.
If the current behavior is a bug, please provide the steps to reproduce.
Create a fresh package with webpack
, webpack-cli
and webpack-dev-server
as devDependencies
.
// src/index.js
console.log("Hi");
Launch the server:
webpack serve --mode=production
Open the src/index.js
file in VSCode. You’ll notice in the console’s output that every time you press save, the code gets compiled twice. Try with an other editor (such as Sublime) and you’ll see that compilation occurs once, as expected.
What is the expected behavior?
Compilation should occur only once.
Other relevant information:
webpack version: v5.67.0
Node.js version: v16.13.0
Operating System: MacOS Monterey
Additional tools: VSCode v1.63.2
(with default settings + no extensions)
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
YES, it fixes the problem. My bad, I did try downgrading before but to
v5.66.0
only…So this indeed is a #15206 duplicate.
Sure! Here’s what a single save causes: