-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Description
When trying to use guardian-js in Node ESM, the import does not provide a usable constructor. Attempting to do new GuardianClient(apiKey, false) throws:
TypeError: GuardianClient is not a constructor
Steps to Reproduce
- Install
guardian-jsvia npm - Use ESM import in Node 22+:
import GuardianClient from "guardian-js";
const guardian = new GuardianClient(apiKey, false);- Run
node index.js
Expected Behavior
guardian should be an instance of the Guardian client.
Actual Behavior
TypeError: GuardianClient is not a constructor
Notes / Analysis
- Logging the imported object shows:
{ default: [class Client] } - The default export appears to be the class, but
importor destructuring does not work correctly. - Likely cause: the package does not properly support ESM or Node 22+.
Metadata
Metadata
Assignees
Labels
No labels