electron / electron/forge

Works in dev but errors in prod

Open
#3,902 8 comments 0 reactions 0 assignees View on GitHub
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.

### Forge version

7.8.0

### Electron version

35.1.2

### Operating system

macOs 15.3.2 (24D81)

### Last known working Forge version

_No response_

### Expected behavior

When I build my app, it should work like it does in dev

### Actual behavior

When I build the app using `electron-forge make` and run the final binary at `out/make/electron-forge-help-1.0.0-arm64.dmg`, it errors out on startuo with "Cannot find module 'sharp'":

![Image](https://github.com/user-attachments/assets/f6477e24-387d-44da-8e8d-61a9f4fa50bc)

### Steps to reproduce

- clone the reproduction repo https://github.com/damms005/electron-forge-help
- install deps and `npm start` and confirm it works
- build with `npm run make` and run the executable in `./out/make/...`
- you should get error similar to screenshot provided

### Additional information

It seems #1276 and #1250 have same issues, but they are webpack-based and I am unable to transfer my understanding of them to this vite-based project

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.