This is probably relatively easy but this is my first time create a package and using Stencil so I wondered if anyone could shed some light on how to bundle React Wrappers using CommonJS (CJS) and ES Modules (ESM)?
I've followed the docs to create React Wrappers from Web Components - https://stenciljs.com/docs/react. When consuming these components as internal packages within my monorepo everything behaves nicely but when I publish these to npm and consume within the same NextJS app I'm getting an error stating:
../node_modules/@orgName/react-widgets/dist/index.js:1
betting-analysts:dev: export * from "./components/stencil-generated";
betting-analysts:dev: ^^^^^^
betting-analysts:dev:
betting-analysts:dev: SyntaxError: Unexpected token 'export'
I assume this is due to the package needing to export CJS as well as ESM but I'm not able to find anything in the docs and wondered if anyone could shed some light on the best approach for this.