As the title, I currently all 3 parts done individually. I have a react app, node/express server, and an electron wrapping the react app.
I aiming to wrap the react app and node server in Electron. the react app runs on localhost:3000, node running on localhost:8080, so i am not sure how the localhost part will work.
What I got working right now is when I individually run the react app and node server in dev, and then in electron open the mainWindow like this then it works.
mainWindow = new BrowserWindow({
width: 1100,
height: 1000,
webPreferences: {
nodeIntegration: true,
webSecurity: false
}
});
mainWindow.loadURL("localhost:3000");
I also built the react app in build folder and the react build is fine when using an nginx server to serve it. but when I change the startUrl to be this the index.html shows a blank screen. I also noticed that if i open the index.html in chrome it is the same blank screen so it only works when there's a server to serve it.
const startUrl = url.format({
pathname: path.join(__dirname, '../build/index.html'),
protocol: 'file:',
slashes: true,
});
console.log(startUrl)
mainWindow = new BrowserWindow({
width: 1100,
height: 1000,
webPreferences: {
nodeIntegration: true,
webSecurity: false
}
});
mainWindow.loadURL(startUrl);
Any general directions or steps I should do to create this standalone app or is this even possible?
this is the index.html when I run the production build. it seems to have everything it should have for a react app but it's a blank screen