I did follow vite
and it is nice to see other JS bundlers besides webpack trying new ideas.
I do however not agree with the entire premise of its design. Sure fast startup is nice but doing everything to optimize for that is pointless. Assume you work on something more than 15 minutes, it doesn’t matter if its starts in 129ms or 3sec. Loading thousands of files separately on page load is too slow to be practical. ESM makes that a bit better but its still not great. Thats why I added :loader-mode :eval in shadow-cljs. There is a balance to be had here and the more files you have the less useful it is to keep them separate. The slow “bundling” step can be improved with better caching which shadow-cljs already does and webpack will do with v5 too.
I’m also absolutely horrified by the now “common” JS idiom and code layout of one file per function. This is ridiculous in my opinion and not how I want to write code. So if you write more code into one file you do want Closure style DCE to remove everything that wasn’t used. Of course this is all completely subjective and some people may prefer that style.
Ultimately you always want a final bundle step and ESM doesn’t change that.
What I like about snowpack is snowpack install
. Couldn’t care less about the other stuff it now does. This is interesting because you bundle everything once, just like npm install
and after that you can even keep the files in version control. No need to ever run it again until you change dependencies. shadow-cljs
could even consume those files instead of npm
directly and either load them via ESM or bundle normally.
I see snowpack as a “take random madness from npm and turn it into somewhat sane ESM”. Of course that becomes less useful once more packages actually ship as pure ESM but its a good step in that direction.