I have a backend CJS application & a frontend ESM application. And a node module I have created in ESM.
The node module works fine for my ESM application because they are both using ESM import
syntax.
Trying to consume it in the CJS application obviously throws errors as it cannot read the ESM import
syntax.
I've tried using Rollup.js
to convert the ESM
code into CJS
and using conditional exports
in my package.json
file but this does not work.