Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pino logger crashed webpack production build #3518

Open
3 tasks done
sebestindragos opened this issue Feb 29, 2024 · 2 comments
Open
3 tasks done

pino logger crashed webpack production build #3518

sebestindragos opened this issue Feb 29, 2024 · 2 comments

Comments

@sebestindragos
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.3.0

Electron version

29.1.0

Operating system

macOS 14.3.1 Sonoma

Last known working Electron Forge version

No response

Expected behavior

npm run make should successfully create a production webpack bundle.

Actual behavior

npm run make crashes with the following error:
image

Steps to reproduce

Clone this example project: https://github.com/beastx-ro/electron-pino-crash-sample
npm run make

Additional information

Hi! I've been trying to integrate pino logger into my electron-forge project.
Due to the way pino is architected (logs are actually handled in a web-worker) I had to make some changes to the webpack config:

  • add the pino-webpack-plugin to the main config
  • change the output.filename in webpack.main.config.ts to make pino files output separately from the rest of the bundle

Now, the interesting part is that in debug mode (npm run start) it works, I can successfully see pino-pretty logs in the console. But when I try to make a production build it fails with the mentioned webpack error.

I've been trying to figure out how to fix it, but no luck so far. I don't think the problem is with pino since the debug app works, has something to do with how forge-webpack does the bundling.

Any help would be appreciated. Thanks!

@DevanceJ
Copy link
Contributor

Hi Dragos,
I am trying to understand the error and find a way to seamlessly integrate pino into electron-forge project. Meanwhile I suggest a work around for logging could be electron-log.

@sebestindragos
Copy link
Author

sebestindragos commented Mar 31, 2024

Hi Dragos, I am trying to understand the error and find a way to seamlessly integrate pino into electron-forge project. Meanwhile I suggest a work around for logging could be electron-log.

Thanks for the reply. The main reason why I wanted to add pino is because of its dynamic transport support. So in dev I would use pino-pretty and in prod pino-lodgna. Since I could't get it working I just used @logdna/logger directly.

Would be nice to get pino working tho. I tried looking into this myself, but I don't have experience with webpack so I got stuck.

Thanks again and enjoy the rest of your weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants