Whenever I am reloading my electron app using Ctrl+R or just from the app def" /> Whenever I am reloading my electron app using Ctrl+R or just from the app def" /> Whenever I am reloading my electron app using Ctrl+R or just from the app def"/>

How to Reload, Force-reload an electron app that made using Angular and have Lazy-loading?

107 Views Asked by At

As I am using lazy loading, in the index.html I am using <base href="/">

Whenever I am reloading my electron app using Ctrl+R or just from the app default windows menu, it's getting all white, I can't even see anything in console.

I have tried mainWindow and getCurrentWindow reload method, but it's not working.

I have already used reload on shortcut

mainWindow.reload()

I have used getCurrentWindow

var reload = ()=>{
  getCurrentWindow().reload()
}

globalShortcut.register('F5', reload);
globalShortcut.register('CommandOrControl+R', reload);

This is How I am creating Window and splash screen

function createWindow() {
    mainWindow = new BrowserWindow({
        resizable: true,
        height: 720,
        width: 1280,
        center: true,
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false,
            enableRemoteModule: true,
        }
    })

    mainWindow.loadFile('dist/index.html');
    mainWindow.hide();
    var splash = new BrowserWindow({
        width: 768,
        height: 432,
        frame: false,
        maximizable: false,
        resizable: false,
    });
    splash.loadFile('html/splash.html');
    setTimeout(function () {
        splash.close();
        mainWindow.show();
    }, 3000);
}

app.whenReady().then(() => {
    createWindow()
    app.on('activate', function () {
        // On macOS it's common to re-create a window in the app when the
        // dock icon is clicked and there are no other windows open.
        if (BrowserWindow.getAllWindows().length === 0)
            createWindow()
    })
})
0

There are 0 best solutions below