Re:Rust Is the Future of JavaScript Infrastructure
by dexwiz on Thursday November 11, 2021 @03:42PM
(#29192902)
At this point, if you are only targeting modern browsers, it's more for the bundler than the transpiler. The module loader standard is still a mess, mostly because there is little incentive to fix it. Unless you are using HTTP/2 or another streaming connection, loading the hundreds of project files and thousands of dependencies, is just not feasible. The compilers also do a bunch of tree shaking to remove dead code from your dependency graph.
[ Parent
| on HN ]
Re:Rust Is the Future of JavaScript Infrastructure
by sroussey on Thursday November 11, 2021 @03:53PM
(#29193012)
It will be interesting to see a tool that does dead code elimination (tree shaking) and minimization, then writing back individual es6 module files for http2. Maybe one of tools can be configured to do so now?
Re:Rust Is the Future of JavaScript Infrastructure
by jsmith45 on Thursday November 11, 2021 @04:39PM
(#29193525)
The Rollup tool supports that in conjunction with the `preserveModules` option. I've never used it outside of playing around, so can't vouch for it from experience, but yeah it exists. It can also do more of course, like convert to older module formats or the like, but obviously you don't need to use that.
The biggest downside is that even in http2 or http3, bundles can still perform better in terms of lower overall loading times, since individual modules you need to download the first one, and perform at least a bit of parsing to find the other modules statically imported before you can start downloading those, repeat.
Re:Rust Is the Future of JavaScript Infrastructure
by sroussey on Monday November 15, 2021 @12:49PM
(#29230160)
Right, though you could use HTTP2 push, but to do that right… you would need a tool to know which files are bundled and their order and… it looks like today.
With one exception though… cache invalidation of a single source file would not invalidate an entire bundle or chunk.