Comments (4)
Unfortunately I don't know. I've never tried logging from the bootstrap script that loads the window.
What do you need to log that isn't loggable elsewhere?
from electron-with-create-react-app.
i think its beacause the server is constantly realoading and re-renders everything
im triying a simple ipc comunication and i dont know how to manually test it. How can i stop server and hot reloading?
from electron-with-create-react-app.
You probably need to eject your app, as the hot reloading it part of create-react-app.
from electron-with-create-react-app.
There is no logging from electron-starter.js because if you take a look at electron-wait-react.js, you can see that electron is actually being called from a child_process via exec. Because of this, the logging goes to a buffer that we have to provide in a callback. However, this gets really inefficient, as you'd have to close the electron app each time to check the logging.
The best way I've found to fix this issue would be to run electron from a child_process.spawn(). This way, we can bind the stdout of the child_process and log it right away.
`onst tryConnection = () => client.connect({port: port}, () => {
client.end();
if(!startedElectron) {
console.log('starting electron');
startedElectron = true;
const { spawn } = require('child_process');
const child = spawn('npm', ['run', 'electron']);
child.stdout.on('data', (data) => {
console.log(`child stdout: ${data}`);
});
child.stderr.on('data', (data) => {
console.error(`child stderr: ${data}`);
});
child.on('exit', function (code, signal) {
console.log('child process exited with ' +
`code ${code} and signal ${signal}`);
});
// const exec = require('child_process').exec;
// exec('npm run electron',(error,stdout,stderr) => {
// console.log(stdout);
// });
}
}
);`
from electron-with-create-react-app.
Related Issues (20)
- [WARN] Cannot read property '1' of null HOT 6
- logging from `electron-starter` HOT 3
- env file not found HOT 1
- Error when quitting app HOT 2
- CSS hotreload HOT 1
- images broken after building with electron-builder HOT 7
- Throwing errors with Python 3.x HOT 2
- Trying to use rethinkdb HOT 10
- throw new errors.Error('ERR_UNKNOWN_SIGNAL', signal); HOT 4
- BrowserWindow#loadUrl niside of electron.screen "display-added" callback causes infinite recursion
- .env file is being overwritten HOT 1
- Running last version of react-scripts will cause to launch the app in both Browser and Electron window HOT 3
- Can't get click event to register at all in desktop app... works in the browser HOT 2
- Last package.json for ts. HOT 4
- window.require doesn't work with latest version of electron HOT 1
- Module not found: 'child_process' HOT 3
- How do we run this in production? HOT 1
- Doesn't work with electron version 8 HOT 1
- Hello,I want to know how can I update the ico of the packaged .exe file for the electron package HOT 2
- The trick no longer works HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-with-create-react-app.