There is a perfectly good name for this that is used in many other contexts, called "dead code elimination", which is also fairly self-explanatory if you haven't come across the term before.
There is a perfectly good name for this that is used in many other contexts, called "dead code elimination", which is also fairly self-explanatory if you haven't come across the term before.
That article claims that "tree shaking" is different because:
> Rather than excluding dead code, we’re including live code.
That's a misunderstanding of the term "dead code elimination". Classic dead code elimination techniques have always worked by first identifying potentially live code and then eliminating the rest.
Tree Shaking is dead code removal. They're one and the same.
I certainly didn't _invent_ the term 'treeshaking', I merely (unwittingly) helped popularise it in the JS ecosystem. The relevant parts of the Twitter thread:
> the reality is that at the time i wrote that, when Rollup was in its early stages, minifiers empirically didn't eliminate as much code as Rollup did
> i think it's worth looking at this from the perspective of the respective terms' connotations, rather than the strictly technical definition (which i agree has been overstated; mea culpa for my part in that). DCE is something you do to programs; treeshaking is what you do to libraries. It may be the same thing, but the prevalence of the idea of treeshaking has put the onus on library authors to make their libraries DCE-able, in a way that has coincided with the adoption of ESM