Frontend Masters Boost RSS Feed https://frontendmasters.com/blog Helping Your Journey to Senior Developer Tue, 16 Apr 2024 22:09:46 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 225069128 require(esm) in Node.js https://frontendmasters.com/blog/requireesm-in-node-js/ https://frontendmasters.com/blog/requireesm-in-node-js/#comments Tue, 16 Apr 2024 22:09:17 +0000 https://frontendmasters.com/blog/?p=1707 Joyee Cheung made some waves in Node land last month:

Since ESM was shipped in Node.js, for many years, it was possible to import cjs, but not possible to require(esm). The frustration of ERR_REQUIRE_ESM has bothered many and probably has been the primary source of wasted hours in the Node.js ecosystem. If package authors wanted to make sure that both CJS and ESM users can consume their package, they either had to continue shipping their modules as CJS, or ship both the CJS and ESM version

Apparently, it will go out in v22, which isn’t out yet but should be soon.

It seems to me this should alleviate some of the pain the Node world is still feeling where projects and their dependencies are still a mix of both. But the true impact remains to be seen. Will you be upgrading to v22 to soothe any pain of your own?

]]>
https://frontendmasters.com/blog/requireesm-in-node-js/feed/ 1 1707