我正在使用 phantomjs 扩展 https://github.com/iradul/vscode-phantomjs-debug ,这对于让我进入主模块非常有用,但我无法调试到/modules 目录中的模块。
该项目设置为:
\parent
--main.js
\parent\modules
--processing.js
processing.js 以通常的方式拉入 main.js,并在 main.js 顶部添加 require
我确信 .vscode/launch.json 中有一个设置可以让我进入processing.js 文件,我只是不确定它是什么。
processing.js 是我处理 page.onXXX 函数的地方,例如 page.onError、page.onResourceRequested 和 page.onResourceRecieved。
这不是一个 typescript 项目 - 直接 js。
最佳答案
由于 Phantom 的远程调试器当前无法解析加载模块的完整路径,VS 调试器只能猜测它们在哪里。您必须将模块放置在 node_modules
目录中。此外,在调用模块的 require
之后,您还必须在主模块内的某个位置放置断点。
查看此内容以获取更多信息: https://github.com/iradul/vscode-phantomjs-debug/wiki/Debug-modules
关于javascript - 如何在VSCode中调试phantomjs的辅助文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37624811/