I have attempted various solutions to eliminate the blank screen issue in my electron
application:
(1) I tried commenting out createProtocol
and loadURL('app:...')
in background.js
and instead using path.join()
:
if (process.env.WEBPACK_DEV_SERVER_URL) {
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
// win.loadURL('app://./index.html')
win.loadURL(path.join(__dirname, 'bundled/index.html'));
}
(2) I set the router mode to 'hash'
:
const router = new VueRouter({
mode: process.env.IS_ELECTRON ? 'hash' : 'history',
base: process.env.BASE_URL,
routes
})
(3) I included a created()
hook with a '/'
route in the newly created Vue instance:
new Vue({
router,
store,
vuetify,
render: h => h(App),
created() {
// Prevent blank screen in Electron builds
this.$router.push('/')
}
}).$mount('#app')
Unfortunately, none of these solutions resolved the blank screen issue. What else could be causing the problem?