Skip to content

Conversation

@nathanclevenger
Copy link

Problem

Node.js ESM mode requires explicit file extensions for subpath imports from packages. The current code imports from react-reconciler/constants without the .js extension, which works in Bun but fails in Node.js:

Error: Cannot find module 'react-reconciler/constants' 
imported from @opentui/react/index.js
Did you mean to import "react-reconciler/constants.js"?

This breaks projects using @opentui/react with Node.js-based test runners like Vitest running in ESM mode.

Solution

Add the .js extension to the two react-reconciler/constants imports:

  • packages/react/src/reconciler/host-config.ts
  • packages/react/src/reconciler/reconciler.ts

This is backward compatible - the .js extension works correctly in both Bun and Node.js.

Testing

Tested with Vitest in a pnpm monorepo - the import errors are resolved.

….js ESM

Node.js ESM requires explicit file extensions for subpath imports.
Without the .js extension, Node.js throws:

  Error: Cannot find module 'react-reconciler/constants'
  Did you mean to import "react-reconciler/constants.js"?

This affects projects using @opentui/react with Node.js test runners
like Vitest that run in ESM mode.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kommander
Copy link
Collaborator

@msmps you can probably better judge the impact.

@msmps msmps self-assigned this Jan 13, 2026
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.

3 participants