Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@pipecat-ai/client-js",
"version": "1.5.0",
"license": "BSD-2-Clause",
"type": "module",
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding "type": "module" to package.json requires Jest/ts-jest ESM configuration. The current Jest configuration uses "preset": "ts-jest" without ESM-specific settings. When "type": "module" is set, ts-jest needs to use the "ts-jest/presets/default-esm" preset instead, and additional configuration is needed:

  1. Change the preset to "ts-jest/presets/default-esm"
  2. Add "extensionsToTreatAsEsm": [".ts"]
  3. Add "moduleNameMapper" with "^(\.{1,2}/.*)\.js$": "$1" to handle .js imports from .ts files

Without these changes, tests may fail when running with the ESM module type.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤨 -- and yet, they ran and passed without these changes. of course, we don't have many so... 🤔

"main": "dist/index.js",
"module": "dist/index.module.js",
"types": "dist/index.d.ts",
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the "module" field while adding "type": "module" changes the package's export strategy. Consider adding an "exports" field to provide explicit entry points for modern Node.js and bundlers. This is the current best practice for ES modules:

"exports": {
  ".": {
    "types": "./dist/index.d.ts",
    "default": "./dist/index.js"
  }
}

This provides better control over how the package is consumed and prevents deep imports. Note that client-react still uses the dual "main"/"module" approach, so this change creates inconsistency between the two packages in this monorepo.

Suggested change
"types": "dist/index.d.ts",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},

Copilot uses AI. Check for mistakes.
"source": "index.ts",
"repository": {
Expand Down