Skip to content

fix(build): write the root entry as CommonJS - #336

Merged
jfrench9 merged 1 commit into
mainfrom
bugfix/root-entry-commonjs
Nov 25, 2026
Merged

jfrench9 merged 1 commit into
mainfrom
bugfix/root-entry-commonjs

Conversation

@jfrench9

Copy link
Copy Markdown
Member

Summary

prepare.js wrote the package-root index.js with ESM export syntax, while the rest of the build is CommonJS and package.json declares no "type". Node still loaded it, but re-parsed it as ESM and printed a MODULE_TYPELESS_PACKAGE_JSON warning on every import of the package root. The root entry is now written as CommonJS, in the re-export shape tsc emits.

Changes

  • prepare.js: the generated index.js uses __exportStar(require(...)) and a getter for client instead of export *. index.d.ts is unchanged

Compatibility

INTERNAL (packaging). The root exports the same 283 names as before. An ESM import * as m additionally shows the standard CommonJS interop keys (default, __esModule, module.exports). Named ESM imports and require both resolve as before. Subpath entries are untouched.

Testing

Ran node prepare.js, then compared the package root's export names before and after (identical apart from the three interop keys). Confirmed no MODULE_TYPELESS_PACKAGE_JSON warning, a named ESM import (client, LedgerClient, materialize), and require. The pre-commit gate passed: format:check, lint, typecheck, Vitest (522 tests). Not proven in a consumer app from a packed tarball.

🤖 Generated with Claude Code

@jfrench9
jfrench9 merged commit 69ce054 into main Nov 25, 2026
5 checks passed
@jfrench9
jfrench9 deleted the bugfix/root-entry-commonjs branch November 25, 2026 05:53
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.

1 participant