For a long time, I’ve been intimidated by JavaScript builds. They have a reputation for being complicated, difficult to understand, and unforgiving. This tracks with my past experiences. I have been burned before, so my approach has been to avoid builds, and just use script tags like it is 2005. Yes, it is possible to do this.
A blog post by Julia Evans offered a way forward. She describes her experiences with a simpler build tool called esbuild. Following Julia’s lead, I gave esbuild a try with some Kingsborough Library Vue code. It really opened up a lot more doors than I expected. Helpfully, using a build for Vue allowed me to take advantage of Vue’s single-file component system. The result was that I could make my code more modular, and access nice features like scoped CSS. Most importantly, the build itself just worked! No impenetrable errors, no mysterious behaviors. It behaved as expected. This is a low bar, but I was thrilled.
I don’t think I trust esbuild enough to use it on the production library homepage yet, but I will keep experimenting with it. So far it is promising.