4 ms·
I followed advice of Sindre Sorhus [1] and moved all my packages and apps to ESM year ago and couldn't be happier. Only Jest and ts-jest were problematic, so I
by jakubmazanec 2y ago
I followed advice of Sindre Sorhus [1] and moved all my packages and apps to ESM year ago and couldn't be happier. Only Jest and ts-jest were problematic, so I replaced them with Vitest. I also never encountered problems because of the so-called dual-package hazard [2]; but IMO this isn't that much different than when you have two copies of React in node_modules - it's simply an npm/dependencies problem, not ESM problem.
[1] https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3...
[2] https://nodejs.org/api/packages.html#packages_dual_package_hazard https://nodejs.org/api/packages.html#packages_dual_package_h...
- simlevesque 2y agoPeople never wanna work or learn. It's not even that big a pill to swallow.
- drschwabe 2y agoRefactoring your entire codebase just to use that one ES module that is incompatible with CJS is a big pill to swallow if your codebase is ... big (or you have many).
- jakubmazanec 2y agoTrue, but if you just do it, even if it's a large undertaking, the benefits of ESM-only code are bigger than being able to use more packages. And someday you will have to move to ESM anyway.
- pictur 2y agoThe last sentence is a good way of consoling yourself. I hope no one takes his advice seriously and implements it. Good luck with your own nonsense.
- drschwabe 2y agoOn the flip side we have other amazing devs who are also active with cutting edge libraries and simply do the small amount of extra work to make their modules available in both ESM and CommonJS to this day: https://github.com/WebReflection/uhtml https://github.com/WebReflection/uhtml