fix: add AcpClient as named export for CJS compatibility (#95)#175
Open
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Open
fix: add AcpClient as named export for CJS compatibility (#95)#175degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #95 —
TypeError: AcpClient is not a constructorProblem
When consuming the package via CommonJS
require(),AcpClientis only available asmodule.exports.default, not as a named export. This causes:when users write:
Fix
Added
AcpClientto the named exports insrc/index.tsalongside the existingexport default AcpClient. This ensures both ESM and CJS consumers can access the class:import AcpClient from ...✅ (unchanged)import { AcpClient } from ...✅ (new)const { AcpClient } = require(...)✅ (fixed)Testing
tsupand verifiedAcpClientis available as bothmodule.defaultandmodule.AcpClientin the CJS output