How to debug only one js file How to debug only one js file google-chrome google-chrome

How to debug only one js file


Open up settings in chrome dev tools, click on "Blackboxing" or possibly "Manage framework blackboxing" and set up file names or regex patterns. Any scripts matching this will not be debugged when you are stepping through your own code and reach a point at which you would enter that script.


Based on adamtickner's explanation here is a detailed description.Let's assume the file you want to debug is "src/app.js"

In Chrome open the debugger using F12 and then click settings (gear icon ⚙ , top right window corner). Select the "Ignore List" menu item.

enter image description here

So far so easy. The tricky part is to add the right regular expression. We need an expression saying "everything, except...". This can be done by a technique called "negative look-arounds"

Our positive expression would be:

src\/app\.js

We just escaped the slash and the dot as these are reserved regex characters.

Now, using negative look-arounds, our expression should look like this:

^((?!src\/app\.js).)*$

This expression will find anything which does NOT contain our file path. You can test it with regex101. Add this pattern to your Ignore List and you are done! Chrome will maybe show a misleading message when you debug in this file like "This script is on the debugger's ignore list" - just ignore this message.