Title: [Bug] ESM builds missing .js extensions in @bitgo/abstract-utxo (>=10.7.0) and @bitgo/utxo-core (>=1.24.0) · Issue #7660 · BitGo/BitGoJS · GitHub
Open Graph Title: [Bug] ESM builds missing .js extensions in @bitgo/abstract-utxo (>=10.7.0) and @bitgo/utxo-core (>=1.24.0) · Issue #7660 · BitGo/BitGoJS
X Title: [Bug] ESM builds missing .js extensions in @bitgo/abstract-utxo (>=10.7.0) and @bitgo/utxo-core (>=1.24.0) · Issue #7660 · BitGo/BitGoJS
Description: Environment Details OS: macOS / Linux (Docker) Node Version: 22.14+ Package Manager: pnpm 10.17.1 BitGoJS Version: @bitgo/abstract-utxo@10.8.0, @bitgo/utxo-core@1.25.0 BitGo Environment: Both testnet and mainnet Expected Behavior ESM bui...
Open Graph Description: Environment Details OS: macOS / Linux (Docker) Node Version: 22.14+ Package Manager: pnpm 10.17.1 BitGoJS Version: @bitgo/abstract-utxo@10.8.0, @bitgo/utxo-core@1.25.0 BitGo Environment: Both testn...
X Description: Environment Details OS: macOS / Linux (Docker) Node Version: 22.14+ Package Manager: pnpm 10.17.1 BitGoJS Version: @bitgo/abstract-utxo@10.8.0, @bitgo/utxo-core@1.25.0 BitGo Environment: Both testn...
Opengraph URL: https://github.com/BitGo/BitGoJS/issues/7660
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug] ESM builds missing .js extensions in @bitgo/abstract-utxo (\u003e=10.7.0) and @bitgo/utxo-core (\u003e=1.24.0)","articleBody":"## Environment Details\n\n- **OS:** macOS / Linux (Docker)\n- **Node Version:** 22.14+\n- **Package Manager:** pnpm 10.17.1\n- **BitGoJS Version:** `@bitgo/abstract-utxo@10.8.0`, `@bitgo/utxo-core@1.25.0`\n- **BitGo Environment:** Both testnet and mainnet\n\n## Expected Behavior\n\nESM builds in `dist/esm/` should use proper Node.js ESM-compatible imports with explicit `.js` file extensions for relative imports, allowing the packages to be consumed in ESM projects.\n\n## Current Behavior\n\nESM builds use relative imports without `.js` extensions, causing `ERR_MODULE_NOT_FOUND` errors when importing the packages in Node.js ESM environments.\n\n**Error 1 (`@bitgo/abstract-utxo`):**\n```\nError [ERR_MODULE_NOT_FOUND]: Cannot find module\n'/app/node_modules/@bitgo/abstract-utxo/dist/esm/abstractUtxoCoin'\nimported from '/app/node_modules/@bitgo/abstract-utxo/dist/esm/index.js'\n```\n\n**Error 2 (`@bitgo/utxo-core`):**\n```\nError [ERR_MODULE_NOT_FOUND]: Cannot find module 'bip174/src/lib/utils'\nimported from '/app/node_modules/@bitgo/utxo-core/dist/esm/paygo/psbt/payGoAddressProof.js'\n```\n\n## Possible Solution\n\nThe TypeScript compilation for ESM output needs to add `.js` extensions to all relative imports. This can be achieved by:\n\n1. Using `tsc-alias` or `tsconfig-paths` post-processing\n2. Setting `moduleResolution: \"NodeNext\"` with proper TypeScript configuration\n3. Using a bundler plugin like `rollup-plugin-add-import-extension`\n\n**Example of broken vs fixed imports:**\n\n```javascript\n// Current (broken)\nexport * from './abstractUtxoCoin';\nimport { foo } from './address';\nimport { checkForOutput } from 'bip174/src/lib/utils';\n\n// Expected (fixed)\nexport * from './abstractUtxoCoin.js';\nimport { foo } from './address/index.js';\nimport { checkForOutput } from 'bip174/src/lib/utils.js';\n```\n\n## Steps to Reproduce\n\n1. Create an ESM Node.js project (`\"type\": \"module\"` in package.json)\n2. Install `@bitgo/sdk-coin-zec@2.6.0` (which depends on `@bitgo/abstract-utxo@10.8.0`)\n3. Import the package:\n ```javascript\n import { Zec } from '@bitgo/sdk-coin-zec';\n ```\n4. Run with Node.js 22+:\n ```bash\n node index.js\n ```\n5. Observe `ERR_MODULE_NOT_FOUND` error\n\n## Affected Versions\n\n| Package | Last Working | Broken |\n|---------|--------------|--------|\n| `@bitgo/abstract-utxo` | 10.6.0 (CJS only) | \u003e=10.7.0 (ESM introduced) |\n| `@bitgo/utxo-core` | 1.23.0 (CJS only) | \u003e=1.24.0 (ESM introduced) |\n\n## Workaround\n\nWe are currently using pnpm patches to add `.js` extensions to all ESM imports:\n\n```json\n{\n \"pnpm\": {\n \"patchedDependencies\": {\n \"@bitgo/abstract-utxo@10.8.0\": \"patches/@bitgo__abstract-utxo@10.8.0.patch\",\n \"@bitgo/utxo-core@1.25.0\": \"patches/@bitgo__utxo-core@1.25.0.patch\"\n }\n }\n}\n```\n\nThis is not sustainable as patches need to be regenerated for each version upgrade.","author":{"url":"https://github.com/jakubswierczek","@type":"Person","name":"jakubswierczek"},"datePublished":"2025-12-01T22:27:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/7660/BitGoJS/issues/7660"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ca42f0ba-9a03-6c24-2de7-eeacd4f24aaa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B634:BB336:153317A:1B6443B:69908187 |
| html-safe-nonce | cafdaffe64d0b81e37fb3872742f1d56628aa05d420488f7ef452e608ed5a978 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjM0OkJCMzM2OjE1MzMxN0E6MUI2NDQzQjo2OTkwODE4NyIsInZpc2l0b3JfaWQiOiIxMjA5ODU3NzMxNzQ3NDE0NDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | aee9e4243c12a517009deb361bcecc8a3fc6ff715d20bdf15a1d62eb5fe758d7 |
| hovercard-subject-tag | issue:3683125799 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/BitGo/BitGoJS/7660/issue_layout |
| twitter:image | https://opengraph.githubassets.com/426718f24f164385aded77767e7a0f262ac82c3f1e5076491e91b45e2f57a370/BitGo/BitGoJS/issues/7660 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/426718f24f164385aded77767e7a0f262ac82c3f1e5076491e91b45e2f57a370/BitGo/BitGoJS/issues/7660 |
| og:image:alt | Environment Details OS: macOS / Linux (Docker) Node Version: 22.14+ Package Manager: pnpm 10.17.1 BitGoJS Version: @bitgo/abstract-utxo@10.8.0, @bitgo/utxo-core@1.25.0 BitGo Environment: Both testn... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakubswierczek |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/BitGo/BitGoJS git https://github.com/BitGo/BitGoJS.git |
| octolytics-dimension-user_id | 6267684 |
| octolytics-dimension-user_login | BitGo |
| octolytics-dimension-repository_id | 20121980 |
| octolytics-dimension-repository_nwo | BitGo/BitGoJS |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20121980 |
| octolytics-dimension-repository_network_root_nwo | BitGo/BitGoJS |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width