-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
HMR is not working with webapp in monorepo #13648
Comments
Start a new pull request in StackBlitz Codeflow. |
I just tried it out and found that hmr works for me, if you are interested and have time, you can check the following repo. https://github.com/haijie-x/vite-issues/tree/master/monorepo-hmr In my opinion, there are 2 points that may need attention:
Not sure if I misunderstood you, but I hope this can help you. |
@haijie-x I checked your points and it turned out that they actually fixed my initial reproduction example. I also checked those things in my source project and there was still the same issue... I looked to it once again and prepared more advanced example that shows the issue: I changed the structure of packages a bit, modified tsconfigs and added tailwind. This is basically 1:1 config that we have in SaaS Boilerplate repository where the issue exists. Now you should see that when
and in browser dev console:
|
I'm experiencing the same issue. @mkleszcz did you find a resolution? |
This is fixed by #14241 in 4.4.10+. |
Describe the bug
The HMR is generating a 404 error when a React component is altered. This component originates from another package within the monorepo. This problem is limited to configurations that include the Tailwindcss plugin, although it may potentially affect other configurations. The issue also appears in instances where packages have been specifically named. For example, using 'webapp' as the root of the app and 'webapp-core' for shared components.
It seems the issue lies with the
fileToDevUrl
function, which contains the following condition:The condition
'webapp-core'.startsWith('webapp') === true
causes the function to return a relative path that begins with/../
. This portion is subsequently removed from the URL utilized to reload a component.Reproduction
https://stackblitz.com/edit/vitejs-vite-ejez9c?file=packages%2Fwebapp-core%2Fsrc%2Ftest-component.tsx
Steps to reproduce
Run:
pnpm i
cd packages/webapp
pnpm run dev
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: