Yesterday, I pondered whether or not build tools are an anti-pattern in modern web development.
In it, I shared this quote from Blake Watson…
The worst part of this is that the web platform is probably one of the most backward compatible runtimes in the history of computing… Build steps ruin this.
In response, I got a question from one of my readers asking how exactly build tools break backwards compatibility.
Projects that use build tools? Well… to work with them, you need your build tools to actually build. And that’s not always guaranteed.
You could theoretically never update your
node_modules directory. Commit it to the git repo (considered an anti-pattern). Ignore the ever growing list of warnings and errors and deprecation notices and security alerts that show up in terminal.
Then, I suppose, your project will continue to work forever (theoretically).
But that’s a pretty fragile house-of-cards to build on. That’s a lot of extra, redundant code to keep with your repository. Ignoring security warnings? Probably not a great idea. And what happens to those archaic
node_modules directories when you get a new computer or your old one dies unexpectedly?
And we haven’t even talked about how JS bundlers will start to throw bugs when new syntax that didn’t exist when they were created gets thrown into them.
The one error I run into constantly with rollup.js on older projects I go to update is around the conditional chaining operator, which is supported in newer versions of rollup, but not the one I was using a few years ago.
So beyond the security implications and “better hope you don’t delete that
node_modules folder” considerations, there’s also the simple fact that you’re locking yourself in to the Web Platform as it exists at the time when your build tools were installed.
One of my least favorite things as a developer is wanting to do a quick patch fix on an older project—I’m talking a simple one-line of CSS kind of fix—but first having to spend 30 minutes patching my build tools to get them running again.
Increasingly, I’m starting to feel like build tools are more trouble than they’re worth.