3 ms·
In two-and-a-half months the last 5 stable releases on Node, the last 2 LTS releases of Node, and all current major browsers will support standard JS modules.
by spankalee 6y ago
In two-and-a-half months the last 5 stable releases on Node, the last 2 LTS releases of Node, and all current major browsers will support standard JS modules.
It's time we all published standard JS modules and only standard JS modules to npm.
- mantap 6y agoI feel the opposite. ESM is a nightmare and I hope I can avoid using it in node as long as possible.
- pilif 6y agothat's the attitude that brought us sites only working in Internet Explorer (and now Chrome) IE had many non-standard APIs that were much more convenient to use than what the standard was providing (innerHTML, document.all) And rather than moving to the standard, more and more code was written targeting IE which also had a conveniently large user-base. ESM is the standard. CJS is the solution proprietary to node.js.
- dfabulich 6y ago> the last 2 LTS releases of Node (Author here.) Node 14 supports ESM, but Node 12 only supports ESM behind the --experimental-modules flag, and its error handling for incorrectly importing CJS is not good. In 2020, I think it's a bit early to go ESM only, especially since it's straightforward for CJS libraries to support both CJS and ESM clients. (I document how to do this in the article.)
- colinr 6y agoThe experimental flag was recently removed in v12.17.0 (though the release notes still say ESM is an experimental feature) https://github.com/nodejs/node/releases/tag/v12.17.0 https://github.com/nodejs/node/releases/tag/v12.17.0