cannot log message when react app be loaded by electron
See original GitHub issueI create a react app and use debug
, debug(xxx)
can work well on browser. but on electron
user window.loadUrl("http://localhost:3000")
load page, open electron dev tools, debug()
cannot work.
code demo: https://github.com/huyinghuan/debug-issue
setup install deps:
cd $project
yarn install
cd ui
yarn install
run react app
cd $project
cd ui
yarn start
open browser, http://localhost:3000
in console
debug work well.
run electron: new terminal
cd $project
yarn start
when loaded page, in dev tools
debug output nothing.
react app index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import Debug from "debug";
const debug = Debug("ui:App");
localStorage.debug = "ui:*"
debug("hello")
ReactDOM.render(
<React.StrictMode>
<div className="App">
debug test
</div>
</React.StrictMode>,
document.getElementById('root')
);
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Electron React app not getting same instance of the logger as ...
I log a message from main.js and it appears in the log file and the console ... Do you load electron-log by the...
Read more >Electron React : Unable to view console log from react
The react app having console logs however not able to view the logs anywhere. how do I view these log messages.
Read more >Build a Secure Desktop App with Electron Forge and React
In this article, we'll create a simple desktop application using Electron and React. It will be a small text editor called “scratchpad” that ......
Read more >Electron with React JS under 40 min! - YouTube
Your browser can't play this video. Learn more.
Read more >Building an Electron application with create-react-app
I recently built an Electron app using create-react-app. I didn't need to muck about with Webpack, or “eject” my app, either.
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
Yeah I guess it didn’t occur to me that
Verbose
is off by default, and since we now useconsole.debug
by default, this is going to hit a few people.The
localStorage
stuff is indeed documented, but the call to enable Verbose logging is not. I would merge a PR if you (or someone) added that last screenshot (in https://github.com/debug-js/debug/issues/808#issuecomment-1027516372) to the README. 🙂Good catch!
@Qix- , I opened a PR just now (linked above). Thanks for telling me about this package’s use of
console.debug
, as that helped me include some context about the issue and screenshot in the README.