Skip to content

chore: convert repository to ESM - #345

Merged
Mrtenz merged 4 commits into
mainfrom
mrtenz/esm
Sep 24, 2026
Merged

Mrtenz merged 4 commits into
mainfrom
mrtenz/esm

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Currently, the package is built as both CommonJS and ESM using @ts-bridge/cli. This PR replaces that with ESM-only output built with standard tsc.

The motivation is to simplify the build toolchain by removing thets-bridge dependency 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 collapses exports to a single ./dist/index.js plus ./dist/index.d.ts, dropping separate main/module and conditional import/require entries. Yarn workspace constraints in yarn.config.cjs are updated to enforce that shape.

Build & test: Replaces @ts-bridge/cli with tsc via tsconfig.build.json (JS emit enabled, not declarations-only). Removes @arethetypeswrong/cli, ts-node, and the test:package / attw pack check; test is now Vitest only. Test imports use explicit ./index.js paths for Node16 resolution.

Tooling: ESLint turns off import-x/no-useless-path-segments for ESM. LavaMoat Yarn plugins point at .cjs files, build gets a new lavamoat/scripts.build.json permission profile, and scriptsConfig wires build/test to the appropriate LavaMoat configs.

Reviewed by Cursor Bugbot for commit abab44e. Bugbot is set up for automated code reviews on this repo. Configure here.

@Mrtenz
Mrtenz added this pull request to stack #347 September 24, 2026 12:00
@Mrtenz
Mrtenz marked this pull request as ready for review September 24, 2026 12:32
@Mrtenz
Mrtenz requested a review from a team as a code owner September 24, 2026 12:32
@Mrtenz
Mrtenz merged commit aa4a96e into main Sep 24, 2026
28 checks passed
@Mrtenz
Mrtenz deleted the mrtenz/esm branch September 24, 2026 12:36
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