First of all my entire codebase is in TS. I have an api which is in CJS. It imports a common
library in my Monorepo that is in originally in ESM. (type: module in package.json) but this is build with tsup in js files in esm and cjs. BUT the problem is that my Time.cjs file import another file (Random.js) in my common
lib and I think tsup don't correctly link this. It keeps the Random.js instead of Random.cjs. Or maybe am I missing something? Thanks in advance for the help.
Internal error occurred during message handling. Please check your implementation. Error [ERR_REQUIRE_ESM]: require() of ES Module /app/packages/common/dist/Random.js from /app/packages/common/dist/Time.cjs not supported.
Instead change the require of Random.js in /app/packages/common/dist/Time.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/app/packages/common/dist/Time.cjs:1:88)
at /app/apps/api/dist/types/subscriptions/index.js:1:748
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too