[Bug]: "Cannot find module './index' or its corresponding type declarations" in react-router-dom/server.d.ts
neoGeneva opened this issue · comments
What version of React Router are you using?
6.23.0
Steps to Reproduce
Install react-router-dom in a TS project, and attempt to compile the project.
Expected Behavior
The project compiles.
Actual Behavior
An error is raised during compilation:
node_modules/react-router-dom/server.d.ts:3:58 - error TS2307: Cannot find module './index' or its corresponding type declarations.
3 import type { FutureConfig, Location, RouteObject } from "./index";
~~~~~~~~~
In a previous version this import looked like this:
import type { FutureConfig, Location, RouteObject } from "react-router-dom";
And there are no recent changes in source here. So I guess something has changed in a build process maybe?
Broken by #11358
Also of note, @markdalgleish pointed out we needed to make this change here: #11358 (comment)
A temporary workaround may be to import/require from react-router-dom/dist/server
, but I'm not 100% sure.
This is resolved by #11514 and will be available in the next release
🤖 Hello there,
We just published version 6.23.1-pre.0
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!