Describe the bug
Hot-Reload wont work when despondencies of background.js changed.
To Reproduce
Steps to reproduce the behavior:
// src/background.ts
'use strict'
import path from 'path'
import { app, protocol, BrowserWindow, Tray, Menu, Notification } from 'electron'
import { createProtocol, installVueDevtools } from 'vue-cli-plugin-electron-builder/lib'
import { getConfig } from './common/config'
const isDevelopment = process.env.NODE_ENV !== 'production'
protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }])
let win: BrowserWindow | null
function createWindow () {
...
}
if (app.requestSingleInstanceLock()) {
app.on('ready', async () => {
... // Install Vue Devtools
const config = getConfig()
if (!config.hideOnStart) {
createWindow()
}
})
...
} else {
app.quit()
}
// src/common/config.ts
export function getConfig(){
...
}
Edit src/common/config.ts, but the background process wont be reloaded
Expected behavior
background process should be reloaded after its dependencies updated
Screenshots
Environment (please complete the following information):
Microsoft Windows [Version 10.0.18363.778]v14.2.06.14.41.22.4^1.4.6You need to add the file to the mainProcessWatch array in vue.config.js:
```js
// vue.config.js
module.exports = {
pluginOptions: {
electronBuilder: {
// Provide an array of files that, when changed, will recompile the main process and restart Electron
// Your main process file will be added by default
mainProcessWatch: ['src/myFile1', 'src/myFile2'],
}
}
}
Most helpful comment
You need to add the file to the
mainProcessWatcharray invue.config.js:```js
// vue.config.js
module.exports = {
pluginOptions: {
electronBuilder: {
// Provide an array of files that, when changed, will recompile the main process and restart Electron
// Your main process file will be added by default
mainProcessWatch: ['src/myFile1', 'src/myFile2'],
}
}
}