developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.06k stars 361 forks source link

The zero-configuration bundler for tiny modules #831

Closed oshalom-dcg closed 3 years ago

oshalom-dcg commented 3 years ago

Why you use the word tiny? I am currently using micro bundle for an entire component library and it works perfectly fine

developit commented 3 years ago

It's not designed for larger use-cases, even if it happens to work okay for them.

Shakeskeyboarde commented 3 years ago

Even though this is closed, I'm going to give a slightly more detailed answer.

Because microbundle creates a single JS file, the library no longer supports tree shaking. Any time you import a single component, you will incur the entire library size as a cost in your web app bundle.

That being said, you could use microbundle as part of a mono-repo, so that each component and utility is it's own microbundled library. But it may be more trouble than it's worth. It's probably a better idea to only use microbundle when consumers of your library would reasonably expect to use the entire library.