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]: Using a Monorepository doesn't work properly #8801

Closed
Meierschlumpf opened this issue Apr 17, 2022 · 2 comments
Closed

[Bug]: Using a Monorepository doesn't work properly #8801

Meierschlumpf opened this issue Apr 17, 2022 · 2 comments
Labels

Comments

@Meierschlumpf
Copy link

What version of React Router are you using?

6.3.0

Steps to Reproduce

Open the command line and run the following commands

git clone https://github.com/Meierschlumpf/react-router-dom-issue.git
cd react-router-dom-issue
yarn
cd apps\example
yarn start

The React application should open on port 3000

Expected Behavior

Both links, the one defined in the UI-Libary and the direct link in the example app should work.

HomePage in apps/example/src/app/pages/home.tsx

import { UILink } from "@template/ui";
import { Link } from "react-router-dom";

export const HomePage = () => {
	return (
		<div>
			<h1>Home</h1>
			<UILink />
			{/*<Link to='/other'>Go to other Link</Link>*/}
		</div>
	);
};

UILink in libs/ui/src/index.tsx

import { Link } from "react-router-dom";

export const UILink = () => {
	return <Link to='/other'>Go to other Page</Link>;
};

Actual Behavior

Only the direct Link works. The Link that is used in the external libary throws the following errors:
image

That is in my opinion a wrong behaviour as it should just render the link as normal.

@timdorr
Copy link
Member

timdorr commented Apr 18, 2022

You likely have two copies of React Router included in your projects. This isn't a bug in React Router, but indicates a problem with your monorepo/build setup.

@timdorr timdorr closed this as completed Apr 18, 2022
@Meierschlumpf
Copy link
Author

Meierschlumpf commented Apr 18, 2022

Thanks god, thank you very much! I wouldn't been able to consider that fact. 🙏
I've updated my repository with the required changes.

brophdawg11 pushed a commit that referenced this issue Mar 27, 2024
Co-authored-by: Pedro Cattori <pcattori@gmail.com>
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