5 ms·
>Why do you think it's important that they implement import/export? For compatibility. Everyone is moving toward ES6 modules, so if you write your app in Comm
by jnbiche 11y ago
>Why do you think it's important that they implement import/export?
For compatibility. Everyone is moving toward ES6 modules, so if you write your app in CommonJS now, you'll likely have to re-factor it into ES6 modules in the future.
Not a deal-breaker, but it's certainly needed (and it sounds like Node devs are well aware of this).
- Touche 11y agoI think you're mistaken, CommonJS is not going away, Node is not going to deprecate CommonJS modules, there is too much code that depends on it.
- jnbiche 11y agoThat's true, but more and more code will be written using es6 modules (since people want to write the same code on both the frontend and backend). But yes, you're correct that it will be years before CommonJS is removed, if ever. Although I could see it being tagged as deprecated in the next few years. I personally would have been totally fine with CommonJS on the frontend, as a longtime browserify user. Almost wish that had happened simply to avoid the transition to another module system for the Node ecosystem. But es6 modules do have certain advantages for the frontend, like making tree-shaking easy.
- kalms 11y agoTree shaking?
- jnbiche 11y agoDead code elimination (more or less). Important for making browser JavaScript as small as possible.
- colordrops 11y agoStatic analysis to exclude unused imports in a bundle.