Does anyone know why I am getting duplicates of the webpack runtimes in the bundle?

It's adding multiple numbers after the ? and the browser is seeing them as new files.

  • dev-server.js?
  • dev-server.js?52d4
  • dev-server.js?53d4*

webpack-dupes

See the file tree on the left: webpack-dupes2

Why is it doing this? I just want one copy of the file in the bundle.

upvote
  flag
Do you have multiple entries in your configuration? Reading from the webpack-dev-server code it creates a server/client pair per each entry. That could be one explanation. – Juho Vepsäläinen
upvote
  flag
Interesting. I do have 3 entry points in my webpack config, and I'm getting 3 duplicates. Let me check that and update. – TetraDev
upvote
  flag
Yeah. That's what I would expect to see. Here's the code that does that. – Juho Vepsäläinen
upvote
  flag
I'm guessing each of your entries points at jwt-decode. Hence those warnings. – Juho Vepsäläinen
upvote
  flag
You are right! I combined my 3 entry points into 1 file, and made it 1 entry point, and no more duplication! If you make an answer I'll give you the credit. Now I just wonder why he wrote the code to put those duplicates, do you think we should make a pull request to modify that so it doesn't duplicate the codes? – TetraDev
upvote
  flag
It was a bug fix by the looks of it so I'm thinking the lines are there for a purpose. I'll set up an answer based on all of this. – Juho Vepsäläinen

1 Answers 11

up vote 0 down vote accepted

Webpack sets up a client/server pair for each entry by design. That's why you are seeing all of those prints. Given each entry happens to depend on jwt-decode, you also get those warnings.

Here's the relevant code. The code was introduced as a part of a bug fix.

Not the answer you're looking for? Browse other questions tagged or ask your own question.