-
Notifications
You must be signed in to change notification settings - Fork 64
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
Debugging react app with hot-reloading does not work #215
Comments
I had similar issue. The debug cannot start. Only create "Tab 1", "Tab 2", "Tab 3" .... "Tab N" in the Visual Studio Code -> Call Stack Panel. And the react web page only reload and reload and reload inside of firefox browser. |
@sirlordt I think you have a different issue. In my case, debugging works correctly as long as I do not change any code. I have updated title and description to make this clearer. |
@philipreimer This is a long-standing bug in CRA (facebook/create-react-app#6074), see also here. |
Try adding |
@hbenl What I noticed: I sometimes had to manually reload the page in the browser (F5) after hot-reload before breakpoints were hit. Another issue is that I can't seem to set any breakpoints inside arrow functions like the following (code sample from a react app in typescript):
If I set a breakpoint in line "2" above it is ignored. Breakpoint only works if I change the code to the following:
But that might be another issue because it happens also when restarting the dev-server, not only after hot-reloading. |
Steps to reproduce:
npx create-react-app my-app
export BROWSER=none && yarn start
launch.json
belowconsole.log('foo')
Result:
After changing anything in App.js file, and the changed code gets hot-reloaded in the dev server, no breakpoint is hit anymore.
Sometimes breakpoints are still hit and code execution stops but at the wrong line in the vscode editor. This usually happens if you remove or add lines of code in a file, where you previously set a breakpoint. It seems as if the debugger still stops at the line where the breakpoint was before adding / removing lines of code.
Expected Result:
all breakpoints should still be working after changing and hot-reloading code
Note:
Debugging works as expected as long as I restart the dev server (
yarn start
) after every code change. But I think that is not the way it was intended to be done?launch.json:
The text was updated successfully, but these errors were encountered: