Skip to content

fix: add AcpClient as named export for CJS compatibility (#95)#175

Open
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7:fix/issue-95
Open

fix: add AcpClient as named export for CJS compatibility (#95)#175
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7:fix/issue-95

Conversation

@degenpepe7
Copy link

Summary

Fixes #95TypeError: AcpClient is not a constructor

Problem

When consuming the package via CommonJS require(), AcpClient is only available as module.exports.default, not as a named export. This causes:

TypeError: AcpClient is not a constructor

when users write:

const { AcpClient } = require("@virtuals-protocol/acp-node");

Fix

Added AcpClient to the named exports in src/index.ts alongside the existing export default AcpClient. This ensures both ESM and CJS consumers can access the class:

  • ESM: import AcpClient from ... ✅ (unchanged)
  • ESM: import { AcpClient } from ... ✅ (new)
  • CJS: const { AcpClient } = require(...) ✅ (fixed)

Testing

  • Built with tsup and verified AcpClient is available as both module.default and module.AcpClient in the CJS output
  • No breaking changes — the default export is preserved

…tocol#95)

When consuming the package via CommonJS require(), AcpClient was only
available as module.default, not as a named export. This caused
'TypeError: AcpClient is not a constructor' when using destructured
imports like: const { AcpClient } = require('@virtuals-protocol/acp-node')

This fix adds AcpClient to the named exports alongside the existing
default export, ensuring both ESM and CJS consumers can access it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: AcpClient is not a constructor

1 participant