VisualStudioCodeからElectronを起動するためのlaunch.jsonの書き方。
GitHubで検索して見つかる基本パターンは下記。
launch.json
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Electron App",
"type": "node",
"program": "${workspaceRoot}/main.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/electron-prebuilt/dist/electron.exe",
"env": { },
"sourceMaps": false
}
]
}
一方、electron-prebuildをinstall -gした場合は、これでは動かないので、以下のように書き換える必要がある。
launch.json
{
...
"runtimeExecutable": "[nodeのルートフォルダ]/bin/electron.cmd",
...
}
起動の仕方とかは下記の記事などを参照。
Visual Studio CodeでNode.jsデバッグ