Repository navigation
fix: resolve dinero.js factory regardless of CJS/ESM resolution - #299
Conversation
…mers Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: f5edc13 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 990308a351
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // build (`module`). When this package's CJS entry `require('dinero.js')` is itself bundled by a | ||
| // consumer using `mainFields: ['module', 'main']` (e.g. esbuild for Lambdas), the ESM build is | ||
| // picked and `.default` becomes the module namespace -> "TypeError: (0, x.default) is not a function". | ||
| const bundledDeps = new Set(['dinero.js']); |
There was a problem hiding this comment.
Add a patch changeset for this fix
This publishable bundle change has no corresponding file under .changeset/ (the commit tree contains only the Changesets README and config). Because .github/workflows/ci-cd.yml releases exclusively through changesets/action, merging this commit leaves the package at version 5.9.0 and does not create a release PR or publish the fix, so affected consumers remain broken until an unrelated changeset eventually triggers a release. Add a patch changeset for @epilot/pricing.
Useful? React with 👍 / 👎.
Keep dinero.js external; unwrap nested default exports so consumers bundling with mainFields module,main no longer hit '(0, x.default) is not a function'. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
dinero.jsexternal (unchanged build config).src/money/dinero.ts, which unwraps nesteddefaultexports to find the dinero factory.formatters.tsandto-dinero.tsuse it.TypeError: (0, x.default) is not a functionwhen a consumer bundles this package's CJS entry withmainFields: ['module','main'](e.g. esbuild for Lambdas):require('dinero.js')resolves to the ESM build and the default import becomes the module namespace.Test plan
src/bundle-interop.test.tsre-bundles the CJS and ESM entries withmainFields: ['module','main']and callsformatAmount; it fails without the helpertscclean🤖 Generated with Claude Code