如何调试nodemodule内的代码

1,718 阅读1分钟

调试插件

在当前webpack项目工程文件夹下面,执行命令行:

node --inspect-brk ./node_modules/webpack/bin/webpack.js --inline --progress

其中参数--inspect-brk就是以调试模式启动node:

终端会输出:

Debugger listening on ws://127.0.0.1:9229/1018c03f-7473-4d60-b62c-949a6404c81d For help, see: nodejs.org/en/docs/ins…

谷歌浏览器输入 chrome://inspect/#devices

然后点一下Chrome调试器里的“继续执行”,断点就提留在我们设置在插件里的debugger断点了。