Skip to content

fix: declare Node.js require(esm) engine range - #452

Open
huytdps13400 wants to merge 1 commit into
callstackincubator:nextfrom
huytdps13400:fix/110-node-engine
Open

fix: declare Node.js require(esm) engine range#452
huytdps13400 wants to merge 1 commit into
callstackincubator:nextfrom
huytdps13400:fix/110-node-engine

Conversation

@huytdps13400

Copy link
Copy Markdown

Summary

  • declare the Node.js versions that can load the package’s ESM CLI dependencies from its CommonJS output
  • exclude Node 21 and Node 22.0–22.11, which still throw ERR_REQUIRE_ESM
  • add a patch changeset for react-native-node-api

Closes #110.

Compatibility evidence

The published host output contains require("@react-native-node-api/cli-utils"), while CLI utils is an ESM package. Node’s module history enables this without a flag in Node 20.19.0 and 22.12.0.

Running the same built dist/node/cli/program.js artifact:

  • Node 20.18.3: ERR_REQUIRE_ESM
  • Node 20.19.0: loads
  • Node 21.7.3: ERR_REQUIRE_ESM
  • Node 22.11.0: ERR_REQUIRE_ESM
  • Node 22.12.0: loads

This yields >=20.19.0 <21 || >=22.12.0, while the root Node 24 devEngines remains unchanged for contributors.

Test plan

  • pnpm --filter react-native-node-api test (61 passed)
  • pnpm run build
  • pnpm run lint
  • pnpm run prettier:check
  • pnpm run publint (all published packages pass strict validation)
  • packed react-native-node-api@1.1.1 and verified the tarball includes the engine range

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.

Reliance on require(esm) in the react-native-node-api-modules package may cause onboarding frictions

1 participant