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,6 +9,12 @@ files:
|
||||
- installer/**
|
||||
- build/icon.*
|
||||
- package.json
|
||||
# sharp 는 플랫폼별 prebuilt 가 분리 패키지로 배포됨. Windows 빌드에서는
|
||||
# win32-x64 만 포함하고 linux/* 변종은 묶지 않아 exe 크기를 줄임.
|
||||
- "!node_modules/@img/sharp-linux-*"
|
||||
- "!node_modules/@img/sharp-linuxmusl-*"
|
||||
- "!node_modules/@img/sharp-libvips-linux-*"
|
||||
- "!node_modules/@img/sharp-libvips-linuxmusl-*"
|
||||
# 빌드 전용 `.env.build` 를 설치기 옆에 함께 배포(없으면 조용히 패스).
|
||||
# `.env` 는 서버/개발 실행용이라 빌드 산출물에는 포함되지 않으며, 패키지된 exe
|
||||
# 는 `resources/.env.build` 를 우선 로드함(없으면 `resources/.env` 로 폴백).
|
||||
|
||||
Reference in New Issue
Block a user