Closed timoplus closed 4 years ago
I've noticed that if you choose View/Reload then the app runs correctly. Once running 'npm run electron:run' actually served the app in it's functional state, but all other times it displays the index.html file instead of running the app.
An observant dev might notice this in the electron.main.ts:
const liveReload = process.argv.slice(2).some(arg => arg === '--serve');
...
if (liveReload) {
require('electron-reload')(__dirname, { electron: require(`${__dirname}/node_modules/electron`) });
mainWindow.loadURL('http://localhost:4200');
mainWindow.webContents.openDevTools();
} else {
// Load the index.html of the app.
mainWindow.loadFile('dist.electron/index.html');
}
So this behavior is by design. If you run the app with two flags like this then the app is run.
npm run electron:run -- --serve
This might still be an issue. Running the app with the -- --serve flags causes a blank screen. Running without the flags, as noted above, prints out the index.html, but refreshing the view runs the app. However, I want to have a full screen app with no menu bar. When I have the solution to this issue I will report back here.
This is partially a duplicate of #507.
In that issue, it is noted that after doing an npm run build
and npm run electron:run
typing cmd-r refreshes the page and runs the app.
I'm submitting Bug report
Current behavior
Using npm start runs the app in the browser.
The app loads in the Electron shell but displays the contents of the index.html file instead of the running app.
Expected behavior
App runs in the Electron window instead of showing the source.
Minimal reproduction of the problem with instructions
https://github.com/timoplus/web-electron-rocket
(This repo includes the answers to the creation questions in the readme.)
Environment
Windows 10.