So the other day I tweeted about how I really want people to stop minifying and bundling what they send to NPM. And just to clarify I it's fine if you want to minify and bundle as one of the things you distribute as part of your package, but it shouldn't be the only thing and there are a couple of reasons and what I do for my packages is I actually do have a UMD module that is bundled and I have a minified version of that as well.
So we have two of those and then I've got an ESM.R version which is like fake ESM right now eventually I'll get around to making a native VSM supported version. And then a common JS and those are the the four formats that I shipped to NPM. So the reason that I really really don't want people to exclusively ship minified code is even with source maps can it can be really difficult to debug and especially when we're talking about libraries that I'm interacting with well even even transitive dependencies.
I like to be able to.Stick a console log in there or to step through with a debugger and it's just really difficult to do that if you've minified your code and in particular what motivated me to tweet this in the first place was I was working with a library that minified everything and it ended up minifying its implementation of an abort signal and so the constructor name was incorrect and node fetch actually checks the constructor name to know if what you've passed is an abort signal which we could argue about whether that's necessary or not, but the fact is that it does and becauseThey were minifying it totally is unusable which is a less super annoying.
So that's notification then on the bundling side of things this can get to be a real problem like if for example your bundling a particular library and I'm already using that library in my project MPM can't dedupe that and do means it says, oh you're using this library in this other dependency uses that library too.
So we'll just have them both use the same files and therefore we don't have to send.That code to the browser twice so we don't have to require that code and evaluate it in person all that stuff. And so there are arguments that people make about bundling as like performance improvement so like you could do that with some tools and and that could be useful but it could also be a big problem because then I can't like change the versions of the things that I'm using and I don't have any control over that.
So there are a lot of issues there in general. So, please don't bundle don't minify it's better this way. Let meDo that.