This is reproduction repo for electron builder #5713 issue
Electron can't find module if this module imported from npm workspaces. I guess the reason is that there is no package-lock.json
file in the packed application.
- Clone repo
- Install electron and electron-builder:
npm ci
- Try run in Node:
Expected output:
node /path/to/electron-builder-issue/packages/main/dist/index.cjs
/path/to/electron-builder-issue/packages/renderer/dist/index.html
- Build Electron app:
npm run build
- Try run in Electron:
Expected output:
/path/to/electron-builder-issue/dist/win-unpacked/vite-electron-builder.exe
Actual behaver: Electron throw Error:/path/to/electron-builder-issue/dist/win-unpacked/resources/app/packages/renderer/dist/index.html
Can not find module "@packages/renderer"
- Try to fix
- Go to
cd /path/to/electron-builder-issue/dist/win-unpacked/resources/app
npm install
- Repeat Step 5.
- Go to