build: bundle sharp's win32-x64 prebuilt for Windows packaging
The packaged installer-rp crashed on launch with "Could not load the 'sharp' module using the win32-x64 runtime" because electron-builder ran on Linux and only the Linux sharp variants were present in node_modules. - Add `preinstall:sharp-win32` script that force-installs `@img/sharp-win32-x64@0.34.5` into the local node_modules (npm refuses it on Linux without --force due to its os/cpu restrictions). - Chain that script before both `dist:win` and `dist:win:rp` so future Windows builds always have the native prebuilt available. - Exclude `@img/sharp-{,libvips-}linux*` from the packaged files list in both electron-builder configs so the unused Linux variants don't bloat the portable exe. Verified `release/win-unpacked/resources/app.asar.unpacked/node_modules/ @img/sharp-win32-x64/lib/sharp-win32-x64.node` is present and that no linux sharp variants ship inside the asar. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
"dev:server": "tsc -p tsconfig.server.json && node dist/server/app.js",
|
||||
"installer": "tsc -p tsconfig.installer.json && electron .",
|
||||
"installer:rp": "tsc -p tsconfig.installer-rp.json && electron dist/installer-rp/main.js",
|
||||
"dist:win": "tsc -p tsconfig.installer.json && electron-builder --win --config electron-builder.yml",
|
||||
"dist:win:rp": "tsc -p tsconfig.installer-rp.json && electron-builder --win --config electron-builder-rp.yml"
|
||||
"preinstall:sharp-win32": "npm install --no-save --force @img/sharp-win32-x64@0.34.5",
|
||||
"dist:win": "npm run preinstall:sharp-win32 && tsc -p tsconfig.installer.json && electron-builder --win --config electron-builder.yml",
|
||||
"dist:win:rp": "npm run preinstall:sharp-win32 && tsc -p tsconfig.installer-rp.json && electron-builder --win --config electron-builder-rp.yml"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/archiver": "^7.0.0",
|
||||
|
||||
Reference in New Issue
Block a user