Skip to content

[BUG] Incompatibility with NodeNext #223

@pting-me

Description

@pting-me

Describe the bug
When importing from a TypeScript config using "moduleResolution": "NodeNext", there's the following error:

Module '"react-chessboard"' has no exported member 'Chessboard'.ts(2305) 

To Reproduce

https://github.com/pting-me/sandbox-chessboard

Run pnpm i. Note the TypeScript error in apps/v5-node-next/src/App.tsx.

Expected behaviour

Error should not be visible

Screen Recording or Screenshots

N/A

Environment (please complete the following information):

  • Package version: [e.g. v5.8.6]
  • React version [e.g. v19.2.0]
  • Node version [e.g. v22.14.0]

Desktop (please complete the following information):

irrelevant

Smartphone (please complete the following information):

irrelevant

Additional context

This error does not show up when importing v4, as can be seen in the sample repo. This is likely because v5 introduced "type": "module" inside the package.json.

To fix:

  • The main thing to fix is to ensure that the build output has file extensions within import/export statements. e.g. export * from './Chessboard.d.ts'
  • Often times TypeScript just needs some file extension, and not necessarily the correct one. e.g. export * from './Chessboard.js' would work, even if there's only a Chessboard.d.ts file.
  • To achieve the above, you could either add file extensions in your source, or setup Rollup to do it

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions