IntelliJ IDEA节点Webkit调试不起作用

IntelliJ IDEA Node-Webkit debug is not working

本文关键字:调试 不起作用 Webkit 节点 IDEA IntelliJ      更新时间:2023-09-26

我正在IDEA上设置node-webkit,发现调试问题-断点就是不起作用。

这是我的代码:

index.html

<!DOCTYPE html>
<html>
<body onload="process.mainModule.exports.callback0()">
<script>
    var sup = require('./sup.js')
    document.write(sup.hi())
</script>
</body>
</html>

package.json

{
    "main": "index.html",
    "name": "Test",
    "version": "0.0.0",
    "node-main": "node-main.js"
}

sup.js

module.exports = {
    hi: function() {
        return 'hi'; //breakpoint here don't work
    }
}

node-main.js

var i = 0;
exports.callback0 = function () {
    console.log(i + ": " + window.location); //breakpoint here don't work
}

控制台输出

0: file:///C:/%5CWork%5Cwebkit%5Cwebkitbase/index.html

Html输出

hi

这意味着所有执行的脚本和问题都在IDEA调试中。原因是什么?

看起来像是IDEA中的一个错误。

检查了IDEA 13.1.5和WebStorm 8.0.4。

两者都有这个问题。

此外,在IDEA/WebStorm:中还有许多其他对原始节点WebKit支持的症状

1) debugger语句只在sup模块中有效(在节点主脚本中无效)。

2) index.html调试有效,但行号不匹配。

3) 从index.html进入sup.js是可行的,但它需要一些生成的代码,看起来像:

(function (exports, require, module, __filename, __dirname) { 
    module.exports = {
        hi: function() {
            return 'hi'
        }
    }
});

在IDEA/WebStorm错误跟踪器中有一些关于这个问题的活动,但从其强度来看,人们可能要等几个月才能考虑认真使用IDEA节点webkit集成。