-
-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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 aChessboard.d.tsfile. - To achieve the above, you could either add file extensions in your source, or setup Rollup to do it
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working