修复开发模式下页面无法刷新的问题

This commit is contained in:
lyswhut
2020-03-31 15:46:19 +08:00
parent 25ae72cd26
commit ef50d90a18
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -15,8 +15,11 @@ app.on('second-instance', (event, argv, cwd) => {
}
})
const isDev = process.env.NODE_ENV !== 'production'
app.on('web-contents-created', (event, contents) => {
contents.on('will-navigate', (event, navigationUrl) => {
if (isDev) return console.log('navigation to url:', navigationUrl)
event.preventDefault()
})
contents.on('new-window', async(event, navigationUrl) => {
@@ -27,7 +30,6 @@ app.on('web-contents-created', (event, contents) => {
})
})
const isDev = process.env.NODE_ENV !== 'production'
// https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = !isDev