basic-electron-react-boilerplate
basic-electron-react-boilerplate copied to clipboard
npm run package shows empty screen
Hello,
after runing npm run build , a dist folder is created and contains files like bundle.js, bundle.css and index.html
But then, if I'm runing npm run prod I see only a blank screen. This happens because the generated index.html is empty:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
<link href="./bundle.css" rel="stylesheet"></head>
<body>
<script type="text/javascript" src="./bundle.js"></script></body>
</html>
I believe the cause is index.js
import React from 'react';
import { render } from 'react-dom';
import App from './components/App';
// Since we are using HtmlWebpackPlugin WITHOUT a template, we should create our own root node in the body element before rendering into it
let root = document.createElement('div');
root.id = "root";
document.body.appendChild( root );
// Now we can render our application into it
render( <App />, document.getElementById('root') );
So we need a something like template (index.html) ? Or how can I fix the issue?
P.S. The same issue if I'm using npm run package
Regards dit
Hi, i have used the commands you mentioned in both branches "master" and "develop". In both branches I see an active electron instance with some text. Is the Dev Console showing some errors?
@dit-j
We are having the same issue as you during packaging. Our suspicion is that the problem lies with the build path to our index.html:
dev
? 'http://localhost:8080?start'
: file://${__dirname}/../../dist/index.html?start'
Have you had any luck resolving this issue?