Black-boxing script option in Chrome Developer tool

[亡魂溺海] 提交于 2019-12-09 16:40:55

问题


I have an issue with the Chrome developer tool.
My version is Version 46.0.2490.71 (64-bit)
According to online tutorials, I can go to Sources tab, right-click a script file and there will be Blackbox Script option to choose.
However, I see no option in my chrome. How do I enable that option since I have no knowledge about regex?




Another problem: The scripts still got debugged even though I added them to blackbox list. Weird!!



One more thing i want to ask is how I blackbox an "unlimited" amount of VM files?


回答1:


  1. Open devtools settings (press F1 once in devtools or open from the menu)
  2. Go to blackboxing (see image below)

  3. Add a pattern, for example:

    • node_modules
    • angular
    • rxjs

It uses regex syntax in case you need something more specific.

The nice part about blackboxing library/framework scripts is that it makes it easier to see in stacktraces from where the error was triggered in your own sources.

EDIT

As other pointed out, since this answer was posted you can directly blackbox a script with a right click on the source file in devtools. However head off to the blackboxing settings UI for more control.




回答2:


There's an easier way in Chrome 60 (and possibly older):

  • Open the source file in Chrome dev tools (in the source tab)
  • Right Click the column that displays the line numbers
  • Select "Blackbox Script"

EDIT: As svict4 pointed out, in Chrome 64, you can also right click anywhere on the script



来源:https://stackoverflow.com/questions/33235824/black-boxing-script-option-in-chrome-developer-tool

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