Why does React hot-reloading on Firefox automatically open the Debugger?

浪子不回头ぞ 提交于 2020-07-20 19:44:07

问题


  • OS: MacOS Catalina 10.15.5
  • Browser: Firefox 78.0.2 with React Developer Tools 4.8.0 add-on enabled
  • IDE: Visual Studio Code 1.46.1
  • Framework: React

This all of a sudden started happening today. Maybe Firefox updated in the background without me knowing, but one minute this never happened, and now it won't stop happening.

Problem: Whenever I save a local file I am working on that has a React error (could be a missing component prop, or improper syntax), Firefox reloads the page but then directs me to the Debugger DevTools tab, and pauses the page. I then have to navigate back to the Console DevTools tab, and manually reload the page. It's very frustrating.

When the browser re-directs to the Debugger, there is a dialogue on the page saying "Paused on debugger statement". The highlighted debugger code is:

// --- Welcome to debugging with React DevTools ---
// This debugger statement means that you've enabled the "break on warnings" feature.
// Use the browser's Call Stack panel to step out of this override function-
// to where the original warning or error was logged.
// eslint-disable-next-line no-debugger
debugger;t.apply(void 0,o)};n.__REACT_DEVTOOLS_ORIGINAL_METHOD__=t,// $FlowFixMe property error|warn is not writable.

The only way to stop this is to disable the React Developer Tools add-on. I don't know how to disabled the "break on warnings" feature. Any help would be deeply appreciated.

===

Edit: I looked at the React Developer Tools Profiler tab, went to Settings, then Debugging, and noticed that the "Break on warnings" was already unchecked. Still unsure what the solution could be.


回答1:


It's a bug from the latest React Dev Tools (4.8.0): https://github.com/facebook/react/issues/19308

Workaround is to toggle the Break on Warnings setting on and then off. They've already cut a release (4.8.1) that fixes the problem.




回答2:


I had the same issue. Toggling the setting on then off again fixed it.



来源:https://stackoverflow.com/questions/62836136/why-does-react-hot-reloading-on-firefox-automatically-open-the-debugger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!