developit / microbundle

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

Install only necessary bundling dependencies #1048

Closed ksenginew closed 1 year ago

ksenginew commented 1 year ago

currently microbundle installs a lot of dependencies with it.

https://github.com/developit/microbundle/blob/105a09b9aa686ac46dc728e774d7ae3aef00aed8/package.json#L70-L113

but some of these are not useful for some users as they don't use that things in their package. As an example:- for a JavaScript library without any typescript code doesn't require typescript tslib of any other typescript related build tools. so it would be bedder if you can mark these dependencies as optional with peerDependenciesMeta option. this would make small install times and faster builds.

Thank you for this great project. I would be like to make a pr for this improvement.

rschristian commented 1 year ago

this would make small install times and faster builds

Any benefit from fewer deps is almost certainly offset by the poor DX that is users needing to wrangle peerDeps if they want Microbundle to build CSS or TS.

Build times shouldn't be affected in any way.

ksenginew commented 1 year ago

@rschristian I think installing packages like typescript is useless for a pure js codebase. Anyway thanks for the clarification. 😸

rschristian commented 1 year ago

TS can also be used to generate TS types for JS sources, for what it's worth. It's not something limited to those who author in TS.

I agree, the situation isn't ideal, but peer dependencies aren't a great DX. Slightly reducing the download size isn't worth it IMO.

rschristian commented 1 year ago

I'm going to close this out as I don't think it's something worth pursuing.