electron / electron/forge

pino logger crashed webpack production build

Open
#3,518 2 comments 0 reactions 0 assignees View on GitHub
bug native-modules plugin/webpack
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] 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](https://github.com/pinojs/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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.