only a blank screen after build
See original GitHub issue- Version:
- electron: “^2.0.3”
- electron-builder: “^20.16.0”
- Target:
current was
dmg
, if works, need to build for windows platform.
Current environment was a create-react-app product, i had reference From React to an Electron app ready for production.
the issue was dev work and build not work, it’s only a blank screen.
some config:
package.json
...
"main": "public/electron.js",
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject",
"electron-dev": "concurrently \"BROWSER=none npm start\" \"wait-on http://localhost:3000 && electron .\"",
"preelectron-pack": "npm run clean-dist && npm run build",
"electron-pack": "build -c.extraMetadata.main=build/electron.js",
"clean-dist": "rm -rf ./dist"
},
"build": {
"appId": "com.example.electron-cra",
"productName": "test-cra",
"files": [
"build/**/*",
"node_modules/**/*"
],
"directories": {
"buildResources": "assets"
}
},
...
public/electron.js
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const path = require('path');
const url = require('url');
const isDev = require('electron-is-dev');
require('electron-debug')();
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({width: 900, height: 680});
mainWindow.webContents.openDevTools()
mainWindow.loadURL(isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`);
mainWindow.on('closed', () => mainWindow = null);
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (mainWindow === null) {
createWindow();
}
});
then in the chrome devTools, has some error:
Failed to load resource: net::ERR_FILE_NOT_FOUND main.4184e132.css
Failed to load resource: net::ERR_FILE_NOT_FOUND main.1445b1ba.js
because of electron version?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to fix the Blank screen After a Static Deployment with ...
Blank, white screen in the browser. It's one of the most annoying situations after deploying a static React app: After all that work, ......
Read more >How to fix the white screen after build with create-react-app?
I just uploaded all my files from the build folder to s3. When I load my S3, it is showing blank screen and...
Read more >How to fix the Whitescreen After a Static Deployment with ...
After installing polyfills, my home screen finally showed up, but any other screen is a blank white screen. ** This only happens in...
Read more >Blank screen after build package (dev works) #672 - GitHub
I encountered following strange behaviour of my app: My dev application works like a charme but if I package my app the inital...
Read more >Site is live, but sill blank screen (react app) - Support
Hi, I have the same issue, my react-app shows a blank screen after successful build. Index.html is in the public folder. Publish directory ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gen4sp I had resolved it by use hashRouter replace browserRouter
@didmehh thank you, it works for guys who use react-router with BrowerRouter 大兄弟救了命🤣