News for hackers. Stuff that matters.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by inquisitiveio on Thursday August 06, 2020 @10:59AM (#24071484)
I'm pretty sure services like pika.dev/skypack.dev/jspm.io are trying to solve the CJS to ESM problem so you can use it directly in the browser (or deno).

Last time I checked they seemed to lean into using rollup to take care of the translation under the covers.

Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by desmap on Thursday August 06, 2020 @11:02AM (#24071524)
That's not the point here. It's about that a thin CJS wrapper to an ESM module isn't possible but the way around is.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by inquisitiveio on Thursday August 06, 2020 @12:06PM (#24072256)
Sorry I misread your comment. But is it not easier to write an CJS wrapper around ESM given that its format is a lot looser?

From what I have seen seems pretty typical to simply export the named properties using a fresh module.exports = {...} and then use default as the main export?