Electron CRA app returns blank screen after redirect to /signin

I am working on an electron project with Create react app. The app works fine in dev.
When I package the app with electron-builder, I am able to login to the user account. However, when I logout and redirect to the /signin route, I get a blank screen. When I check the network tab, I get the error that /signin file is not found.

The build section of my package.json

"files": [
        "from": "dist/src",
        "to": "src",
        "filter": [

The main.js file

const path = require('path');
const url = require('url');

const { app, BrowserWindow } = require('electron');

let mainWindow;

function createWindow() {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true,
      enableRemoteModule: true,

  const startUrl =
    process.env.ELECTRON_START_URL ||
      pathname: path.join(__dirname, './build/index.html'),
      protocol: 'file:',
      slashes: true,

  mainWindow.on('closed', function () {
    mainWindow = null;

app.on('ready', createWindow);
app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
app.on('activate', function () {
  if (mainWindow === null) {


I am using hashrouter for routing.

What could I be doing wrong?

This was resolved. I figured out the logout method was set to redirect using window.location.href .

I passed history as an argument to the logout function and used the push method to get it working.