Closed vibhorgupta-gh closed 2 months ago
These fragments look fine. Could you share a whole project that reproduces the issue? It may be related to a bundler.
@megahertz update: I was able to run this by upgrading my node-polyfill-webpack-plugin
to v4.0.0, but a separate issue has popped up now -> In order for the above error to not come up, i always need to do a yarn && yarn dev
to run my app instead of a simple yarn dev
, otherwise the above mentioned error shows up - this is reproducable 100% of the times in my project. Any ideas what may be causing this?
This may be unrelated, but on every yarn dev
, the undefinedelectron-log-preload.js
file is created in my project root
This library tries to support different bundler environments, but some environments still make it impossible to initialize the logger correctly in a renderer process. If you use any preload script, you may try to import 'electron-log/preload'
instead of running log.initialize()
. Or you can use another initialisation strategy https://github.com/megahertz/electron-log/blob/master/docs/initialize.md
import 'electron-log/preload'
will suffice?main.ts
or preload.ts
?log.initialize({ preload: true })
?Yes, you can add this import statement to preload.js. It's an alternative way to do the same as the log.initialize()
statement does.
This seemed to work, thanks a lot for the help! Will reach out to you if I face any further issues.
I'm running my electron app (v31.1.0) and electron-log (v5.1.2) in it, with the following config:
main.ts
render.ts
this writes my main thread logs to my terminal, also writes my render thread logs to browser console, but it doesn't:
render.log
fileWhat am i doing wrong?