question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dev server compiles twice in VSCode

See original GitHub issue

Bug 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:closed
  • Created 2 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tavoynecommented, Jan 31, 2022

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.

1reaction
tavoynecommented, Jan 26, 2022

Sure! Here’s what a single save causes:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack-dev-server runs twice - Stack Overflow
So right now, my theory is that for some reason webpack-dev-server is running twice, in parallel, and that creates a race condition or...
Read more >
Pipeline is triggered twice for builds and PRs
Only this repository is being triggered twice. It is triggered twice on merges to master, tags, and PRs. The 'Override the YAML continuous...
Read more >
Why is the pre-build step running twice?
Ever time my project is built, the pre-build event command-line is being executed twice by Visual Studio. This happens even if I just...
Read more >
Visual Studio Code Tips and Tricks
Press Esc twice to exit Zen Mode. Side by side editing. Keyboard Shortcut: Ctrl+\. You can also drag and drop editors to create...
Read more >
jsconfig.json Reference - Visual Studio Code
Illustrated below is a project with a client and server folder, ... jsconfig.json is a descendant of tsconfig.json , which is used for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found