3 ms·
I 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.
by Touche 11y ago
I 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.