9 comments

[ 3.5 ms ] story [ 30.7 ms ] thread
"concepts are transferrable and should set you up for building your own bundler."

This is a very informative article and wroth reading. But I wonder, why should I need to build my own bundler?

(comment deleted)
While a bundler itself might be very niche, I believe what is learned here can also be applied to many other areas: building a linter, dead code analyzer, testing framework, code quality checker, diff tool, SRI for files, etc., basically anything that needs to go from an entry point to grab all the files imported in the tree. It's still not a "mainstream need" by any means, but I believe with this article you can do many more things than just a bundler. Fairly well put in the first paragraph IMHO:

> If we think of JavaScript testing as a map-reduce operation that maps over all test files and “reduces” them to test results, then JavaScript bundling maps over all source files and “reduces” them into a bundle

Why should I know how to create a programming language if C already exists?
You should understand the fundamentals of the tools you use, so that when an error pops up in your webpack or SWC build, you understand how to debug the error and fix it.
I think the main reason one would do such a thing is if they cannot find an existing solution which suits their needs.
Makes sense but so another way of phrasing my question is "Aren't the current bundlers good enough for most use-cases already?
Every framework comes with limitations.

The more experienced you are, the more likely you are to be frustrated by the limitations of a framework and set off to write your own.

For example, there are hundreds of Web development frameworks of all sorts around, yet I set out to write my own, and spent five+ years doing it, because I was frustrated by the limitations of all the others.

Does anyone else need my framework? Maybe not.

But I have benefitted from it.

Most? Maybe... but I've wanted a bundler to work with hot code reloading for a while. Snowpack gets close to what I want (at least in theory), but it isn't compatible with my codebase.

Snowpack is open source, but if I do want to contribute to the bundler though, I need to know how bundler work in general or else I won't understand what I am seeing.