News for hackers. Stuff that matters.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by draw_down on Thursday August 06, 2020 @01:03AM (#24068256)
I haven’t seen CommonJS modules for years now, only ES modules. Didn’t realize this was such an issue still.

> You can’t require() ESM scripts

That’s one way to put it! Another would be to say that you don’t have to. require() came about because we didn’t have the import keyword.

Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by dfabulich on Thursday August 06, 2020 @02:39AM (#24068644)
(Author here.)

You were not using native ESM in Node years ago. Node 14 shipped with unflagged ESM support just this year. (If I had to take a guess, you were probably transpiling "import" statements into "require" statements and/or bundles, which honestly works better than native ESM, because there's no interop issue.)

Almost all of the most depended on NPM packages are CJS, and provide no ESM exports. https://www.npmjs.com/browse/depended

lodash, react, chalk, commander, moment, express, axios, and vue are all CJS.

Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by dimgl on Thursday August 06, 2020 @02:27AM (#24068598)
I guess you don't work on Node.js backends.