Rich Harris

medium.com/@rich_harris · Personal blog · on HN since 2015

Rich Harris, creator of Rollup and Svelte, writes about JavaScript modules, bundling, and tree-shaking.

What HN saysHN commenters often cite his tree-shaking versus dead code elimination article, though one finds his argument for the distinction not very compelling.
17HN people shared it
7linked it in comments
12stories submitted
70story points
3 years agolast shared
2015people per year2026

Most-shared posts

  1. 1
    Small JavaScript modules: it's not quite that simple
    7 people · 7 points · first shared 2015 · discussion on HN
  2. 2
  3. 3
    Tree-shaking versus dead code elimination
    4 people · 1 points · first shared 2016 · discussion on HN
  4. 4
    Phonograph.js: tolerable mobile web audio
    2 people · 6 points · first shared 2016 · discussion on HN
  5. 5
    Don’t crAMP our style
    1 people · 2 points · first shared 2015 · discussion on HN

What HN people wrote when they linked it

cakoose · 2021-05-26
Adding to the confusion is this often-cited article: https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-eliminat… 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.
swyx · 2020-08-08
the prevailing consensus esp in the JS world is that 1 tool should do 1 thing. This is fine under the Unix philosophy, but challenges arise due to the combinatorial explosion of config needs, bad errors, and overhead from crossing module boundaries. There are a number of attempts at challenging this status quo: - ESbuild (100x faster than webpack in part due to focus on doing a single parse (but also shipping a Go binary)) - Deno - Rome As we consolidate on the jobs to be done we expect out of modern tooling, it makes sense to do all these in a single pass with coherent tooling. It will not make sense for a large swathe of legacy setups, but once these tools are battle tested, they would be my clear choice for greenfield projects. recommended related reads: - https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simp… - (mine) https://www.swyx.io/writing/js-third-age/
rich_harris · 2016-07-24
> I also fundamentally disagree that plugin repos are a good idea Part of the reason I was motivated to do this work is that I love Three's batteries-included approach – I don't need to spend a long time configuring my project or trying to figure out how to glue different libraries together (I've written more about this here https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simp… Nothing has changed vis-a-vis Three being a drop-in file. But it's a double-edged sword – batteries-included historically means including code that you're not using in your project. ES modules give us the best of both worlds via tree-shaking. And once you've learned them (you're not learning Rollup, you're learning JavaScript – this is a standard we're talking about) you'll find it's much more logical than the alternative. Trust me! The KeyframeTrack thing is just a special case resulting from the codebase's history. It could easily be fixed more elegantly, it was just outside the scope of this PR.
allover · 2017-08-02
Well it wasn't that you weren't being specific, more that you were casually maligning the JS community unfairly, when the article isn't even about web/JS :) (I also don't agree with 'don't need to'. The main takeaway from the leftpad debarcle was the fixes to the npm module deletion policy, and hopefully people learning they shouldn't rely on an 'npm install' for production deployments! Whether people should use small modules is still up for debate, there are trade-offs [1] [2]). [1] https://github.com/sindresorhus/ama/issues/10#issuecomment-117766328 [2] https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simp…
bjterry · 2017-06-06
Typically it would be called dead-code elimination. The creator of rollup who popularized the term tree-shaking disagrees that they are the same, but his argument is not super compelling (not that it really matters either way). https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-eliminat…
sillysaurus3 · 2016-03-24
I've been reading about tree shaking. I'm not at my laptop at the moment, so I can't settle this question by testing it. I'll toss it to the community: https://news.ycombinator.com/item?id=11349606 Basically, how does tree shaking deal with dynamic inclusions? Are dynamic inclusions simply not allowed? But in that case, what about eval? Is eval just not allowed to import anything? I've been reading posts like these, but they are pretty unsatisfying regarding technical detail: https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-eliminat… Maybe someone else was wondering the same thing, so I decided to post it here before wandering off to the ES6 spec to figure it out.
lollipop25 · 2016-02-23
Seriously? isEven? That can be done using `!(n % 2)`. You're generalizing, and yes, you're being too paranoid. Not all of them actually agree on (really very small) modules. https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simp… It all boils down to balance and common-sense.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close