electron-userland / electron-prebuilt-compile

electron-prebuilt with Babel and React built-in
167 stars 50 forks source link

Filter debug protocol argument to support debugger #42

Closed kwonoj closed 7 years ago

kwonoj commented 7 years ago

This PR updates behavior of es6-init to resolve paths to init script, explicitly filtering debugger protocol argument.

Some node.js debugger supports --inspect protocol, (primariliy vscode-node-debug2 https://github.com/Microsoft/vscode-node-debug2) injects --inspect and --debug-brk for their own order and ignore original process argument specified, makes prebuild-compile fail to resolve script path. This PR simply filters them out, preserve original behavior of looking up script paths.

With this PR & latest electron (1.7.x), prebuilt-compile can use vs code config like below to debug main process.

{
      "type": "node",
      "request": "launch",
      "name": "Electron Main",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
      "args": [
        ".",
        "-r",
        "--enable-logging"
      ],
      "protocol": "inspector"
    }

Interestingly, source maps and others are working out of box.

anaisbetts commented 7 years ago

Into it, but because electron-prebuilt-compile tracks Electron 1:1, you have to wait for the next Electron release