News for hackers. Stuff that matters.
Re:The state of JavaScript modules by yladiz on Monday May 29, 2017 @04:50AM (#14438139)
Serious question: what benefit does this (.mjs) have over the current way of doing things?
Re:The state of JavaScript modules by Vinnl on Monday May 29, 2017 @06:35AM (#14438439)
It enables you to not package modules that your app's not using, preventing the dreaded "shipping x MB to your users".
Re:The state of JavaScript modules by yladiz on Monday May 29, 2017 @07:10AM (#14438524)
But can't you just do some "tree shaking" with something like Rollup, so it only sends the code you use?
Re:The state of JavaScript modules by Vinnl on Monday May 29, 2017 @07:21AM (#14438556)
You can only do so _thanks to_ the new module system. From the Rollup website [1]:

> Since this approach is based on explicit import and export statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code.

[1] https://rollupjs.org/#tree-shaking