Closed maxrawlinger closed 1 year ago
Hey 👋🏻 thank you so much for the PR, not 100% certain on all this commonjs, type:module shenanigans.
I ran your codesandbox (thank you so much for that), and did a pnpm patch
where I removed the type: module
— and that seems to work.
Just give me a moment to understand the difference between .cjs
and type: module
. As surely the bundler should read import
from the exports map, than use that.
Hello 👋 Thank you for your timely response.
If it helps in any way, please do not hesitate to contact me regarding the CommonJS/ESM hell :)
Hey mate, I have just shipped diary@0.4.4
which should solve your requirements. Think in general type: module
seems to break too many things upstream.
Think i'll stick to shipping cjs firstclass, with the .mjs
if the bundler knows what to do with it. Hopefully that works for you now 🚀
Let me know how it goes. And thank you so much for submitting the PR in the first place <3
Error: require() of ES Module
Using diary as an dependency within another module, this module raises an error within a node/server side env (e.g. Next.js, Nuxt.js) see picture.
Alternatively, as the error message describes, the file suffix could be still .js but the type declaration of the module itself should be changed to not being an ESM module.
Reproduction example: https://codesandbox.io/p/sandbox/quirky-bassi-7940pf