okikio / bundlejs

An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
https://bundlejs.com
MIT License
797 stars 15 forks source link

[Bug] duplicate dependencies if two imports depend on the same package #39

Closed yellowsink closed 2 years ago

yellowsink commented 2 years ago

I was using bundlejs recently to test the bundle sizes of a library I author, crossani.

I was testing the size of it with two addon packages (@crossani/spring and @crossani/flip), which both import crossani.

Bundlejs did not de-duplicate these imports of the same module, causing a bundle size larger than most real-world build tools would produce, in which one copy of the crossani package is bundled and used by both.

More generally:

okikio commented 2 years ago

Hmm...This issue seems to be due to @crossani/flip and @crossani/spring using 2 different versions of crossani

image image image
yellowsink commented 2 years ago

Ah, that makes sense, my fault then - I should be using peer deps come to think of it...

Also strange that they don't have ^ - must be an issue with my monorepo setup or something.

yellowsink commented 2 years ago

image

image

Was on my end, after fixing package vers is deduping as necessary.

And in case anyone else with this occuring comes across this - make sure if you're using a pnpm monorepo that you are using workspace:^ not workspace^*

okikio commented 2 years ago

TIL, thanks for leaving that feedback