Re:Top-level await in JavaScript is a footgun
by rich_harris on Wednesday September 14, 2016 @04:22PM
(#12500917)
So in the future, you'll have to split up your app into multiple entry points specifically to contain the effects of top-level await spilling out? Sounds like using explicitly async functions would be a far more understandable and maintainable approach.
[ Parent
| on HN ]
Re:Top-level await in JavaScript is a footgun
by robpalmer on Wednesday September 14, 2016 @06:50PM
(#12501881)
So the argument is that the bad-effects of top-level await are viral. One bad apple in the app entry point's dependency graph stalls evaluation of the main entry point. And to mitigate this risk, you have to segregate out sub-graphs that you safely load via imperative import().
Doesn't the same risk apply if one of the modules in the graph declaratively imports a module hosted on a slow external CDN?