Skip to content

Fix(abstract-utxo,utxo-core): add .js extensions for ESM compatibility#8383

Open
0x7365746265726E wants to merge 4 commits intoBitGo:masterfrom
0x7365746265726E:master
Open

Fix(abstract-utxo,utxo-core): add .js extensions for ESM compatibility#8383
0x7365746265726E wants to merge 4 commits intoBitGo:masterfrom
0x7365746265726E:master

Conversation

@0x7365746265726E
Copy link
Copy Markdown

Description

ESM builds in @bitgo/abstract-utxo and @bitgo/utxo-core fail in Node.js with ERR_MODULE_NOT_FOUND.

Root cause: tsconfig.esm.json used moduleResolution: "bundler" which doesn't require .js extensions. Node.js ESM requires explicit extensions.

Changes:

  • Updated tsconfig.esm.json in both packages: moduleResolution and module"NodeNext"
  • Added .js to all relative imports in src/**/*.ts

Issue Number

Fixes #7660

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

# ESM import
mkdir test && cd test
echo '{"type":"module"}' > package.json
npm install ../BitGoJS/modules/abstract-utxo
npm install ../BitGoJS/modules/utxo-core
node -e "import('@bitgo/abstract-utxo').then(() => console.log(' ESM works'))"
node -e "import('@bitgo/utxo-core').then(() => console.log('ESM works'))"

# CJS import
node -e "require('@bitgo/abstract-utxo'); console.log('CJS works')"
node -e "require('@bitgo/utxo-core'); console.log('CJS works')"

# TypeScript types
echo "import { AbstractUtxoCoin } from '@bitgo/abstract-utxo';" > test.ts
npx tsc --noEmit  # passes

Happy to add a test case or reproduction repo if useful — let me know preferred approach.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My code compiles correctly for both Node and Browser environments
  • I have commented my code, particularly in hard-to-understand areas
  • My commits follow Conventional Commits and I have properly described any BREAKING CHANGES
  • The ticket or github issue was included in the commit message as a reference
  • I have made corresponding changes to the documentation and on any new/updated functions and/or methods - jsdoc
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@0x7365746265726E 0x7365746265726E requested a review from a team as a code owner March 31, 2026 20:06
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.

[Bug] ESM builds missing .js extensions in @bitgo/abstract-utxo (>=10.7.0) and @bitgo/utxo-core (>=1.24.0)

1 participant