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

🐛 Issue importing @datadog/browser-rum-react/react-router-v7 #3400

Open
onlydave opened this issue Mar 6, 2025 · 0 comments
Open

🐛 Issue importing @datadog/browser-rum-react/react-router-v7 #3400

onlydave opened this issue Mar 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@onlydave
Copy link

onlydave commented Mar 6, 2025

Describe the bug
react-router-v7 folder is missing from 6.5.0 and 6.4.0 resulting in Cannot find module '@datadog/browser-rum-react/react-router-v7' errors when trying to import from the v7 module

https://www.npmjs.com/package/@datadog/browser-rum-react?activeTab=code

To Reproduce
Steps to reproduce the behavior:

  1. npm install @datadog/browser-rum-react@latest
  2. import { Routes } from "@datadog/browser-rum-react/react-router-v7";

Expected behavior
Expecting to import the react-router-v7 Routes component

Observed behavior:

[vite] Internal server error: Failed to resolve import "@datadog/browser-rum-react/react-router-v7" from "src/routes.tsx". Does the file exist?
  Plugin: vite:import-analysis
  File: /src/routes.tsx:26:9
  1425|  import { Routes } from "@datadog/browser-rum-react/react-router-v7";

A workaround is to import directly from the entries folder:

import { Routes } from "@datadog/browser-rum-react/src/entries/reactRouterV7";

and add react-router-dom-7 as an dependancy in our package.json

"react-router-dom-7": "npm:react-router-dom@7.2.0",

or probably better as the react-router-dom package is being phased out

"react-router-dom-7": "npm:react-router@7.2.0",
@onlydave onlydave added the bug Something isn't working label Mar 6, 2025
@onlydave onlydave changed the title 🐛 My bug title 🐛 Issue importing @datadog/browser-rum-react/react-router-v7 Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant