Re:Modern Node.js Patterns
by stevage on Sunday August 03, 2025 @09:32PM
(#44781349)
I maintain a library also, and the shift to ESM was incredibly painful, because you still have to ship CJS, only now you have work out how to write the code in a way that can be bundled either way, can be tested, etc etc.
[ Parent
| on HN ]
Re:Modern Node.js Patterns
by 8n4vidtmkvmk on Sunday August 03, 2025 @11:37PM
(#44781925)
It was a pain, but rollup can export both if you write the source in esm. The part I find most annoying is exporting the typescript types. There's no tree-shaking for that!
Re:Modern Node.js Patterns
by franciscop on Monday August 04, 2025 @03:00AM
(#44782810)
For simple projects you needed now to add rollup or other build system that didn't have or need it before. For complex systems (with non-trivial exports), now you have a mess since it wouldn't work straight away.
Now with ESM if you write plain JS it works again. If you use Bun, it also works with TS straight away.