Repository navigation
chore: convert repository to ESM - #345
Merged
Merged
Conversation
Mrtenz
added this pull request to stack #347
September 24, 2026 12:00
Mrtenz
marked this pull request as ready for review
September 24, 2026 12:32
cryptodev-2s
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the package is built as both CommonJS and ESM using
@ts-bridge/cli. This PR replaces that with ESM-only output built with standardtsc.The motivation is to simplify the build toolchain by removing the
ts-bridgedependency in preparation for the TypeScript 6+ upgrade.Examples
Based on MetaMask/core#9536.
Note
Medium Risk
Publishing moves to ESM-only entrypoints, which can break CommonJS
require()consumers; build and test tooling changes also alter how releases are validated compared to the prior dual-format + attw flow.Overview
This PR makes the module template ESM-only and simplifies how it is built and published.
Package surface: Adds
"type": "module"and collapsesexportsto a single./dist/index.jsplus./dist/index.d.ts, dropping separatemain/moduleand conditionalimport/requireentries. Yarn workspace constraints inyarn.config.cjsare updated to enforce that shape.Build & test: Replaces
@ts-bridge/cliwithtscviatsconfig.build.json(JS emit enabled, not declarations-only). Removes@arethetypeswrong/cli,ts-node, and thetest:package/attwpack check;testis now Vitest only. Test imports use explicit./index.jspaths for Node16 resolution.Tooling: ESLint turns off
import-x/no-useless-path-segmentsfor ESM. LavaMoat Yarn plugins point at.cjsfiles,buildgets a newlavamoat/scripts.build.jsonpermission profile, andscriptsConfigwiresbuild/testto the appropriate LavaMoat configs.Reviewed by Cursor Bugbot for commit abab44e. Bugbot is set up for automated code reviews on this repo. Configure here.