VSCodeでElectron+Vue.js
プロジェクトの構築
code:sh
cd electron-quick-start
npm install
VSCodeでF5で起動したい
code:.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"console":"integratedTerminal"
}
]
}
インスペクタを毎回開くのがだるい
code:main.js
mainWindow = new BrowserWindow()
mainWindow.maximize()
mainWindow.toggleDevTools()
CDN経由でVue.jsを読み込んで使う
code:index.html
<html>
<head>
...
...
</head>
<body>
<router-view></router-view>
<script type="module">
window.onload = function(){
require('./js/index.js')
}
</script>
</body>
</html>