-
Notifications
You must be signed in to change notification settings - Fork 137
Closed as not planned
Closed as not planned
Copy link
Description
Problem
The following packages ship with "type": "module" and only an "import" condition in their exports field:
chat-
@chat-adapter/whatsapp
-
-
@chat-adapter/shared
-
-
-
-
@chat-adapter/state-memory
-
-
-
-
-
-
@chat-adapter/state-redis
-
-
-
-
-
-
-
-
@resend/chat-sdk-adapter(and its dependencyremend)
This means CJS consumers (projects with"module": "commonjs"in tsconfig) get the following error at runtime:
-
-
-
-
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in .../node_modules/@chat-adapter/whatsapp/package.json
Node's CJS loader looks for a "require" or "default" condition in exports. Since only "import" is present, resolution fails.
Expected
Either:
- Add a
"default"condition pointing to the same ESM file — Node 22.12+ supportsrequire()of synchronous ESM natively, so"default": "./dist/index.js"is sufficient -
- Or ship a separate CJS build with a
"require"condition
- Or ship a separate CJS build with a
Current workaround
Using pnpm patch to manually add "default": "./dist/index.js" to each package's exports — but this must be re-applied on every version bump.
Environment
- Node.js v23.11.0
-
- pnpm 9.x
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels