Is it just me, or Chromium DevTools stopped to stop at breakpoints in node_modules
(including /usr/lib/node_modules
)?
a.js
:
console.log('a.js');
require('./b');
b.js
:
debugger
console.log('b.js');
require('userhome');
$ npm i [email protected]
// add the following lines to node_modules/userhome/index.js:
// debugger
// console.log('userhome');
$ node --inspect-brk a.js
Open about:inspect
in Chromium. Choose the process under Remote Target. Press F8. It stops at b.js
. Press F8 again. It doesn’t stop at node_modules/userhome/index.js
and finishes.
Am I missing something? Is there a way to debug this issue somehow (a way to figure out why it doesn’t stop at node_modules
breakpoints)?
I’m running Chromium 121.0.6167.184 and nodejs v21.6.1.
UPD I just checked on another machine with Chromium 115.0.5790.102 and v20.4.0, and here it works. It had the Node.js V8 –inspector Manager (NiM) extension installed, but I turned it off before testing.
It looks as if node_modules
is considered "uninteresting" in the recent versions of Chromium (and likely Chrome), and as such skipped. I’d like to disable it somehow.
2
Answers
The workaround I've found is... to not use Chromium DevTools. You can debug code with
vscode
:node --inspect
processThe trick is, you can't debug processes running under
root
, as might be the case with processes running indocker
containers.UPD With the help of the
lscr.io/linuxserver/chromium
image I was able to figure out that it stopped working in Chromium around 120:And I soon was able to find in What's new that they added
node_modules
to the ignore list.This is a new feature in Chrome 120, it does "now skip scripts from
/node_modules/
and/bower_components/
by default.".You can turn this off, or remove individual modules from that list, in the Ingore List settings of the devtools.