Repository navigation
fix(cjs): require the ESM entry directly and fail clearly on Node without require(esm) - #39
Merged
Merged
Conversation
…hout require(esm)
index.cjs used createRequire(__filename) to synchronously load index.mjs. That
idiom predates Node's native require(esm) and breaks bundlers (esbuild,
webpack) that don't follow a createRequire-constructed require the way they
follow a literal require() call.
- index.cjs: a plain require("./index.mjs") instead of createRequire. Where
Node.js has no require(esm) (before 20.19 / 22.12) it now throws
ERR_REQUIRE_ESM with a message pointing to import() instead of a bare
loader error.
- index.mjs already had no top-level await, so no change was needed there.
- tests/cjs: node:test checks run by `npm test` and `npm run coverage` after
Vitest: require() returns the same objects as import (type/identity only -
createRemote opens a real ADB connection, so no call is made), and the
version check fires when require(esm) is off.
index.mjs exports createAndroidTVRemote, but index.cjs only exposed the default (createRemote), so require() callers could not reach it. The CJS entry now carries every export the ESM entry has, and the CJS test checks it.
Shinrai
approved these changes
Oct 3, 2026
Shinrai
enabled auto-merge
October 3, 2026 18:26
cldmv-bot Bot
added a commit
that referenced
this pull request
Oct 3, 2026
## 🚀 What's Changed ### 💥 Breaking Changes _No breaking changes_ ### ✨ Features _No new features_ ### 🐛 Bug Fixes - #39 - fix(cjs): re-export createAndroidTVRemote from the CommonJS entry (26d3356) - fix(cjs): require the ESM entry directly and fail clearly on Node without require(esm) (e5b0a75) ### 📦 Dependencies _No dependency updates_ ### 🔧 Other Changes _No other changes_ <details> <summary>👥 Contributors</summary> - @Shinrai </details> --- <!-- coverage-start -->  | Metric | Coverage | |--------|----------| | Statements | 12.7% | | Branches | 9.1% | | Functions | 20.2% | | Lines | 13.0% | *Avg: **13.7%** · `5ae55df` · Node lts/** <!-- coverage-end --> <!-- co-authors --> Co-authored-by: Shinrai <[email protected]>
Shinrai
added a commit
that referenced
this pull request
Nov 8, 2026
## 🚀 What's Changed ### 💥 Breaking Changes _No breaking changes_ ### ✨ Features _No new features_ ### 🐛 Bug Fixes - #39 - fix(cjs): re-export createAndroidTVRemote from the CommonJS entry (26d3356) - fix(cjs): require the ESM entry directly and fail clearly on Node without require(esm) (e5b0a75) ### 📦 Dependencies _No dependency updates_ ### 🔧 Other Changes _No other changes_ <details> <summary>👥 Contributors</summary> - @Shinrai </details> --- <!-- coverage-start -->  | Metric | Coverage | |--------|----------| | Statements | 12.7% | | Branches | 9.1% | | Functions | 20.2% | | Lines | 13.0% | *Avg: **13.7%** · `5ae55df` · Node lts/** <!-- coverage-end --> <!-- co-authors --> Co-authored-by: Shinrai <[email protected]>
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.
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
No new features
🐛 Bug Fixes
📦 Dependencies
No dependency updates
🔧 Other Changes
No other changes
👥 Contributors