News for hackers. Stuff that matters.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by rk06 on Thursday August 06, 2020 @06:38AM (#24069715)
If library authors make esm as a thin wrapper over cjs, won't it hinder tree shaking.

And for tools that want end to end esm, like vite. Won't it cause degradation in behaviour?

Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge... by yabberdabbafoo on Thursday August 06, 2020 @12:45PM (#24072704)
> If library authors make esm as a thin wrapper over cjs, won't it hinder tree shaking.

Correct. I wouldn't follow the article's advice wrapping ESM with CJS as it leads to larger bundles.

> Won't it cause degradation in behaviour?

For web apps - certainly. The forced sync behavior of CJS wouldn't be very noticeable for local applications however.