Works in dev but errors in prod

Open
#3,902 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
electron, typescript, vite
Domain
build-system

Research direction

Clone the linked reproduction repository and first verify that npm start works while electron-forge make produces a packaged app that fails with Cannot find module 'sharp'. Compare the Vite development setup with the packaged output under out/make and review the related issues #1276 and #1250. Done means the packaged macOS application launches successfully with sharp available.

Written by the indexing model from the issue text.

Description

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.
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

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

Dominant language
TypeScript
Stars
7.1k
Forks
642
Avg merge
2d 8h
Merged PRs (30d)
35

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from electron/forge

All issues in electron/forge

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.