Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: (v7) react-router packages and pnpm compatibility #12266

Open
lucaquerella opened this issue Nov 12, 2024 · 1 comment
Open

[Bug]: (v7) react-router packages and pnpm compatibility #12266

lucaquerella opened this issue Nov 12, 2024 · 1 comment
Labels

Comments

@lucaquerella
Copy link

lucaquerella commented Nov 12, 2024

What version of React Router are you using?

v7

Steps to Reproduce

Expected Behavior

no typing error

Actual Behavior

I get typing error:
-Cannot find module 'react-router' or its corresponding type declarations.ts(2307)
-Cannot find module '@react-router/dev/routes' or its corresponding type declarations.ts(2307)

when I import:

import { Outlet, Scripts, ScrollRestoration } from "react-router";
import { index } from "@react-router/dev/routes";

if I add:

"baseUrl": ".",
  "paths": {
    "@react-router/dev/routes": ["./node_modules/@react-router/dev/dist/routes.d.ts"],
    "react-router": ["./node_modules/react-router/dist/index.d.ts"],
  }

everything works fine.

here my full tsconfig.json

{

  "compilerOptions": {
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "target": "ES2022",
    "module": "ES2022",
    "skipLibCheck": false,
    "strict": true,
    "jsx": "react",
    "moduleResolution": "Bundler",
    "baseUrl": ".",
    "paths": {
      "@react-router/dev/routes": ["./node_modules/@react-router/dev/dist/routes.d.ts"],
      "react-router": ["./node_modules/react-router/dist/index.d.ts"],
    }
  }
}
 
@stephen776
Copy link

Same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants