Complete guide to creating Node.js packages with ES6 modules that are easily usable from CJS modules

David Herron
Level Up Coding
22 min readApr 28, 2021

--

It is very tempting to write all JavaScript code on Node.js with ES6 modules. But that creates a problem of interoperability with a large number of existing CommonJS (CJS) modules. Namely, it is difficult to use ES6 modules from a CJS module. Node.js makes it easy to use both CJS and ES6 modules from an ES6 module, and…

--

--

Software Engineer and author (Node.js Web Development and more) passionate about Node.js, climate change, EV’s, and clean energy. https://davidherron.com