Day 2: the js toolchain craze

Arnaud Dagnelies - Sep 21 '22 - - Dev Community

I wanted to publish a small library as npm package. It's basically just a few hundred lines of typescript, nothing big. The code was there, and I just have to wrap it up, right? Well, I was naive again. Somehow, all the programming languages I used in the past had a very precise and clear way how to use, build and share packages, but somehow it's not the case in the JS community.

I was baffled by how many different "build tools" there are. I thought things had settled since last time I used gulp and grunt and webpack and other various build tools (even something like "gobble") but it seems the situation is gotten worse. Now yarn and pnpm are shadowing npm while on the build side you have esbuild, vite, snowpack, neutrino, parcel and bla bla bla. Then put on it some "monorepo" tools like lerna and turborepo and ...holy shit. It's not making things easy. It's also quite the polar opposite of more "traditional" programming languages. Java has maven, Python has pip, X has ... but javascript is like a bazaar with toolchains popping up like fashion trends.

But it gets worse, I was thinking. "Ok, let's go with the flow, let's pick the 'default' toolchain for a typescript lib." So I went to the typescript official site, to see how they minimize stuff and such, and boom! They don't have a standard for that! You have a ticket #8 wishing for having this feature built-in since 2014 but instead they have integrations for a whole list of third party tool(chain)s!

...at the end of the day, I'm still a bit unsure which one I should pick. Heck, I just want to minimize it! In the end, I ended up learning, gauging and assessing a gazillion of different tools doing similar things. Well, let's see how the race evolves next year. ;)

As a first attempt, I tried 'Parcel' which was hailed as the "zero configuration build tool" which fitted my case, but the resulting minified script seemed far from optimally minimized.

Tomorow I'll try using esbuild in combination with typescript a shot, let's hope that does the trick (yes, I'm looking at you sourcemap).


Today was not really productive. ...more annoying.

I was also sidetracked by some library I use as a cornerstone of my UI:

But it misses some really basic things. Like a carousel for example. So in the end, I got sidetracked making a PR for it: https://github.com/cdmoro/bootstrap-vue-3/pull/691

It's not something huge, but it still takes quite some time, also because you spend time looking around the various sources and tools. There are also things I would have done otherwise, but I stopped there to avoid going too much down the rabbit hole. After all, these kind of things are bottomless pits.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .