React 开发工具 - 停用“中断警告”

IT技术 reactjs javascript-debugger
2021-05-16 20:04:12

在使用 create-react-app 进行开发时,我的浏览器在出现警告时进入调试器模式:

在调试器中暂停

它打破了 react-dev-tools 的源代码:

   // --- 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.

如何停用此行为?

4个回答

转到 Chrome Devtools → 在 Chrome 控制台中,转到Component → 单击Settings → 取消设置Break on WarningProfilerSettings → unset Break on warning 中执行相同操作

@cadoman 指出检查,然后取消选中以确保工作。

PS:图片来自https://github.com/facebook/react/issues/19308#issuecomment-656669792

在此处输入图片说明

基于 pull request DevTools: Make break-on-warn off by default #19309这似乎是一个错误。

Break On Warnings 框对我来说是未选中的,它仍然会中断。删除并阅读扩展以强制更新为我修复了它。

我不知道还有什么方法可以强制 Chrome 在其常规计划之外更新扩展程序。

转到选项卡调试中的 ReactDev 工具并禁用“Break on Warning”。

我认为这种新行为今天开始于这个新 PR:https : //github.com/facebook/react/pull/19048

Chrome 有一个“BlackBox 脚本”功能,在这种情况下很有用。

  1. 转到 Chrome 开发者工具 -> 源标签
  2. 从左侧窗格中选择“react_developer_tools.js”
  3. 右键单击文件并选择“黑盒脚本”

在此处输入图片说明