Duplicated dependencies in single webpack bundle, but not in package lock file

Viewed 270

enter image description here

Maybe I don't understand how to read the output of webpack-bundle-analyzer, but it looks an awful lot like both apollo and sentry are being duplicated within the same bundle. I understand this can happen across bundles, or within the same bundle if you have dependencies that require different versions of the same package, but I only see one reference to both of these packages in my package-lock.json file and I only have one bundle here.

Is what I'm seeing in this image actually duplication? If so, why is it happening and how can I fix it? Also, why do the innards of each duplicate look different? Maybe they are not the same version after all? I'm quite confused by this output, and I cannot find any helpful documentation from webpack or the bundle analyzer plugin.

1 Answers

Your understanding of why duplicate modules may appear in outputs is correct.

I believe what you're seeing here is modules from packages being grouped as the result of the ModuleConcatenationPlugin optimization.

What you can instead is creating the bundle report for a development mode build. This should hopefully make it a lot easier to confirm everything is alright.

Related