release: v2.1.7 - require the ESM entry directly and fail clearly on… - #40
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.
…hout require(esm) (#39)
Contributor
Author
🔒 Dependency Review
|
Contributor
Author
|
| File | Raw | Δ Raw | Gzipped | Δ Gzipped |
|---|---|---|---|---|
| index.cjs | 1.5 kB | +529 B (+52.4%) |
787 B | +273 B |
| index.mjs | 898 B | — | 477 B | — |
| scripts/postinstall.mjs | 2.4 kB | — | 995 B | — |
| scripts/setup-device.mjs | 1.5 kB | — | 820 B | — |
| scripts/wake-tv.mjs | 1.3 kB | — | 730 B | — |
| src/lib/android-tv-remote.mjs | 66.3 kB | — | 15.6 kB | — |
| Total | 73.9 kB | +529 B | 19.3 kB | +273 B |
📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.
Shinrai
approved these changes
Oct 3, 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.
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
No new features
🐛 Bug Fixes
📦 Dependencies
No dependency updates
🔧 Other Changes
No other changes
👥 Contributors
Avg: 13.7% ·
5ae55df· Node lts/*Co-authored-by: Shinrai Shinrai@users.noreply.github.com