-
Notifications
You must be signed in to change notification settings - Fork 840
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
React hot reload not working for changes made in index.js #6255
Comments
Hi @gulshanmudgal is your project store on your Windows file system or inside of your Linux file system? (i.e: Is it in /mnt/c ? ) If it is in the Windows file system, I believe you're running into the fact that the Plan 9 server in WSL 2 does not support file watching on Windows files. As a workaround I'd recommend you place your files into the Linux file system (Plus you'll get a performance boost!) Here's our issue tracking this request: #4739 |
I'm getting the exact same behaviour and my files are within the Linux file system. As @gulshanmudgal has said for other files hot reloading works but when I edit index.js it does not hot reload requiring a manual refresh. |
No, My files are already in the Linux file system. |
I am unable to reproduce your problem, I'm able to use hot reload inside of the Linux file system. |
I have created a dummy app here: https://github.com/gulshanmudgal/wsl-6255 |
Also, I have provided comments in the index.js and test.js files. code is available at the github link. |
I tried the project that you sent me and wasn't able to get hot reload working there either. However, I do have hot reload working with other projects. It seems like this overall feature is working, but might not be working for your specific project. @gulshanmudgal could you try using the repro that I used to create this gif and see if you are able to use hot reload? Here's the source code. If you are able to have hot reload there, then it seems like this might be a Linux tooling specific problem. |
the one you shared seems to work, your project is with Gatsby.js, but the Vanilla React one is not working. I can reproduce this issue consistently with Vanilla React. |
Have you taken a look here and tried all these steps? |
Yes, I have, but with no luck. |
Hello, I've caught the same issue.
My project inside Linux system (projects dir I don't get any errors, it just not working. I can't provide the project to reproduce, but might be able to send some logs. UPD: after updating 10.0.18363 to 19042.630, the problem persist only for new files UPD: Same issue if I edit files with |
I'm able to use hot reload on other projects as well that aren't gatsby based (like this calculator demo). It seems like this error might be based on your project. The only other thing I could think of is something within the localhost relay, but I'm unable to repro this error. For the sanity of tracking errors on this Github page I'm going to mark this as closed since I can't find any relevant error, but please reopen it if you can determine any specific repro steps, or @ me here so I can see it. Thanks for filing this! |
@craigloewen-msft Thanks for the quick response, the problem with new files was in my project: I didn't import newly created files in other project files, so 'webpack-dev-server' didn't start rebuilding when I changed them. This is a checklist for troubleshooting, might be useful for those, who get a similar problem with file watching/hot reload in Windows WSL:
More info #4293
|
My script |
I'm using Git bash for Windows but had been facing the same problem. And this is how I solve it with @craigloewen-msft With the same issue as OP explained, for me, the problem was with React update. So it can be possible solution for others. |
I was having this same issue, until I created a |
You hero, this worked for me :) |
Funcionou perfeitamente, obrigado! |
Well, I've just had the same issue. Windows 10 + WSL 2. Here's my question on StackOverflow The thing is... you just have to move your project to \wsl$\Ubuntu-20.04\home<USERNAME>\YOURPROJECT |
@hazartilirot I can't seem to find the \wsl in my CLI, can you help with this? Thank you.. I may have misunderstood. Excuse me if this is basic, I am quite junior with all this. |
Work for me. Thx ! |
guys, you just needed to disable CORS |
Environment
Steps to reproduce
NodeJs version: v15.2.0
NPM version: 7.0.8
Expected behavior
Changes made in index.js is not reflecting on the UI, hence hot reloading fails. For all other files, hot reload works just fine and changes are reflected on the UI, once code is successfully compiled.
Actual behavior
After making changes in index.js, the browser window doesn't refresh and hence have to manually refresh the page to view the changes made in index.js.
The text was updated successfully, but these errors were encountered: