DEV Community

Discussion on: Electron Apps Made Easy with Create React App and Electron Forge

Collapse
 
derekdavie profile image
DerekDavie • Edited

Very helpful thank you!

I ran into one issue I wanted to document in case anyone else ran into it too. When building I was getting a blank screen and it took me awhile to figure out why. In electron.js I changed:
win.loadURL(
isDev
? "localhost:3000"
: file://${path.join(__dirname, "../build/index.html")}
);

to

win.loadURL(
isDev
? "localhost:3000"
: file://${path.join(__dirname, "/../build/index.html")}
);

and it was able to launch my app correctly!

Collapse
 
emuswailit profile image
emuswailit

Apparently this happens when you skip the "homepage":"./" bit in the tutorial. Honestly after days and days of exploring vite-electron, electron react boilerplate, etc this tutorial was the most helpful to me. Not forgetting the sister tutorial on electron sqlite. Thank you @mandiwise ...in 2024!