fenok / react-router-typesafe-routes

Comprehensive and extensible type-safe routes for React Router v6 with first-class support for nested routes and param validation.
MIT License
143 stars 3 forks source link

Error when bundling #48

Open ccapndave opened 5 months ago

ccapndave commented 5 months ago

Hi! I've just found this wonderful looking project and would love to use it in one of my project. However, when I bundle my project I get these errors. Any ideas?

✘ [ERROR] No matching export in "node_modules/react-router-dom/esm/react-router-dom.js" for import "useSearchParams"

    node_modules/react-router-typesafe-routes/dom/useTypedSearchParams.js:12:9:
      12 │ import { useSearchParams, createSearchParams } from "react-router-dom";
         ╵          ~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/react-router-dom/esm/react-router-dom.js" for import "createSearchParams"

    node_modules/react-router-typesafe-routes/dom/useTypedSearchParams.js:12:26:
      12 │ import { useSearchParams, createSearchParams } from "react-router-dom";
         ╵                           ~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/react-router-dom/esm/react-router-dom.js" for import "createSearchParams"

    node_modules/react-router-typesafe-routes/dom/route.js:1:9:
      1 │ import { createSearchParams, generatePath } from "react-router-dom";
        ╵          ~~~~~~~~~~~~~~~~~~

Please let me know if there is any more information I can provide to help debug this.

ccapndave commented 5 months ago

Ah, I see that the problem is probably that my project uses React Router v5 instead of v6. Unfortunately I am forced into this by Ionic, which only supports v5. Is there any way I can still use the library?

fenok commented 5 months ago

Hi! Unfortunately, the current version of the library is only compatible with v6, which significantly differs from v5.

There is an old version that is compatible with v5, but it's quite different and not supported anymore: https://www.npmjs.com/package/react-router-typesafe-routes/v/0.3.2