Skip to content

fix: bundle ESM-only @noble deps in CJS output#197

Merged
Takaros999 merged 1 commit into
mainfrom
takis/fix-cjs-esm-compat
Apr 2, 2026
Merged

fix: bundle ESM-only @noble deps in CJS output#197
Takaros999 merged 1 commit into
mainfrom
takis/fix-cjs-esm-compat

Conversation

@Takaros999
Copy link
Copy Markdown
Contributor

Summary

  • @noble/secp256k1 v2+ is intentionally ESM-only (ref). Our CJS build left it as an external require(), causing ERR_REQUIRE_ESM for consumers whose bundlers output CommonJS.
  • Added noExternal to idkit-server's tsup config to inline @noble/secp256k1 and @noble/hashes at build time.
  • Added CJS compatibility regression test.

Test plan

  • All 41 idkit-server tests pass (39 existing + 2 new CJS compat tests)
  • Verify CJS consumer can require('@worldcoin/idkit-core') without error

…_ESM

@noble/secp256k1 v2+ is intentionally ESM-only. Consumers using CJS
(e.g. bundlers outputting CommonJS) hit ERR_REQUIRE_ESM when our CJS
build leaves it as an external require(). Use tsup noExternal to inline
these deps at build time.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
idkit-js-example Ready Ready Preview, Comment Apr 2, 2026 10:53am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3998150796

ℹ️ 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".

Comment thread js/packages/server/src/__tests__/cjs-compat.test.ts
@Takaros999 Takaros999 marked this pull request as ready for review April 2, 2026 12:58
@Takaros999 Takaros999 merged commit 37d97fd into main Apr 2, 2026
16 checks passed
@Takaros999 Takaros999 deleted the takis/fix-cjs-esm-compat branch April 2, 2026 13:00
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.

2 participants