[PR #511] [CLOSED] fix: add .js extension to react-reconciler/constants imports for Node.js ESM #588

Closed
opened 2026-03-02 23:47:14 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/511
Author: @nathanclevenger
Created: 1/11/2026
Status: Closed

Base: mainHead: fix/esm-constants-import


📝 Commits (2)

  • 21c251a fix: add .js extension to react-reconciler/constants imports for Node.js ESM
  • 059af48 Merge branch 'main' into fix/esm-constants-import

📊 Changes

2 files changed (+2 additions, -2 deletions)

View changed files

📝 packages/react/src/reconciler/host-config.ts (+1 -1)
📝 packages/react/src/reconciler/reconciler.ts (+1 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/511 **Author:** [@nathanclevenger](https://github.com/nathanclevenger) **Created:** 1/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/esm-constants-import` --- ### 📝 Commits (2) - [`21c251a`](https://github.com/anomalyco/opentui/commit/21c251abc467f910c28a175c8ae59fa9e530f47e) fix: add .js extension to react-reconciler/constants imports for Node.js ESM - [`059af48`](https://github.com/anomalyco/opentui/commit/059af48569d407ecd88fed3e38ac307550ebd387) Merge branch 'main' into fix/esm-constants-import ### 📊 Changes **2 files changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/react/src/reconciler/host-config.ts` (+1 -1) 📝 `packages/react/src/reconciler/reconciler.ts` (+1 -1) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:14 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#588
No description provided.