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.

Also warn if the same version is included multiple times

See original GitHub issue

It’s possible for webpack to bundle multiple instances of a module even if the versions are the same. For example, here’s a partial webpack stats output I saw in my project just now. Notice how the WorkboxError module is included 6 times because the paths are different (even though the versions are the same):

[19] ./node_modules/workbox-precaching/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]
[23] ./node_modules/workbox-strategies/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]
[24] ./node_modules/workbox-broadcast-cache-update/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]
[26] ./node_modules/workbox-cache-expiration/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]
[28] ./node_modules/workbox-background-sync/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]
[31] ./node_modules/workbox-routing/node_modules/workbox-core/_private/WorkboxError.mjs 1.42 kB {0} [built]

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
philipwaltoncommented, Mar 27, 2018

I can get you a full set of steps to reproduce the issue later, but off the top of my head here’s how you can do it:

npm install --save-dev workbox-precaching workbox-strategies workbox-broadcast workbox-cache workbox-background workbox-routing

That will install those packages as well as workbox-core @ version 3.0.1. Then you run the following:

npm install --save-dev workbox-core@3.0.0

That will force npm to put a version of workbox-core inside each of the above packages node_modules folder.

Then if you create a bundle the imports the 6 above packages, you’ll see workbox-core modules (e.g. WorkboxError.mjs included multiple times.

0reactions
masterkidancommented, Apr 26, 2018

@caseycarroll42 : Consider the following issue package A -> package B 1.0.0 Package B 2.0.0 In this particular case, as there are breaking changes between the two versions of the packages (assuming they are properly semantic versioned), resolving to the root level package will not be desirable.

Additionally, my understanding is that the purpose of this particular plugin is to alert developers of potential duplications (both major and minor version changes) in their webpack configurations so that you can go ahead and add alias’s like your solution. Hence the reason for an option to check for duplications in the same version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - Header file included twice despite #ifndef - Stack Overflow
However, it seems that it is included multiple times, as I got an error that operator << was defined multiple times. I then...
Read more >
Hooks + multiple instances of React · Issue #13991 - GitHub
My hooks are only used in the body of functional components and I do not have two versions of react running (per the...
Read more >
Need to include one file multiple times, how to avoid warning
I get some warnings when I include one public file in several other files in a same package. It is straightforward to include...
Read more >
warnings — Warning control — Python 3.11.1 documentation
If two or more threads use the catch_warnings context manager at the same time, the behavior is undefined. When testing multiple operations that...
Read more >
Using LD, the GNU linker - Command Line Options
See the -( option for a way to force the linker to search archives multiple times. You may list the same archive multiple...
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