DEV Community

Discussion on: Node.js Package Authors: Please support both CJS and ESM

Collapse
 
endel profile image
Endel Dreyer

Sorry should've argued on the why, but my point of view is that Node.js/JavaScript has users from all types of backgrounds, and more often than you think a "legacy" (or not too legacy) project that heavily uses CJS desperately needs a module that is only available as ESM.

There are still loads of content and tutorials teaching beginners how to use CJS, and they'll stick with it without questioning the existance of ESM, and there you have another project starting as CJS.

Collapse
 
yoursunny profile image
Junxiao Shi

You can call ESM module from CJS module via import() expression. No desperation needed.