Do anyone external react-router-dom-v5-compat #7657
Unanswered
Mikawawawa
asked this question in
Q&A
Replies: 2 comments
-
For example, I will get this error as the compatibility package import v5 version of react-router, but the v6 version is actually required |
Beta Was this translation helpful? Give feedback.
0 replies
-
Will, I find a solution just now, though it may be a bit hack. I patches the react-router-v5-dom-compat with this changes by pnpm
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi teams,
I've been using [email protected] in an online project. However, I recently encountered a requirement that relies on router guards. Since useBlocker after version 6.4 is currently unstable, I've decided to transition to react-router-dom-v5-compat and utilize react-router@5's Prompt feature.
I'm facing challenges in achieving this goal. I've set up React Router as an external dependency because my project is composed of several parts, and the basic dependencies are shared from a 'vendor.js' file. This 'vendor.js' is created using MergeIntoSingleFilePlugin. The issue arises because react-router-dom-v5-compat depends on react-router@6, but the v5 version is included in the vendor file. I'm unsure about how react-router-dom-v5-compat operates, it seems to share the same history from react-router-dom@5 and inject it into its dependencies from react-router@v6. So, if I do not externalize them, there may be two standalone react-router instances with different versions inside the package. The only communication between them is that they share the same history instance?
I guess I should package the vendor.js in another way. Should I bundle react-router@5, react-router@6, react-router-dom-v5-compat@6, react-router-dom@5 together? But I don't know which solution I should use to make it happen.
Here's my code snippet of my MergeIntoSingleFilePlugin and external config
Beta Was this translation helpful? Give feedback.
All reactions