Root cause: electron-builder's @electron/rebuild only rebuilds native modules found in the `files` config. Since better-sqlite3 enters the app through extraResources (via .next/standalone/), it was skipped. The afterPack hook was copying the system Node.js ABI (127) instead of the required Electron ABI (143). Fix: - afterPack now explicitly calls `npx electron-rebuild` targeting the exact Electron version and architecture from the build context - Falls back to @electron/rebuild programmatic API if CLI fails - Fails the build if rebuild cannot complete (no silent failures) - Adds file size logging for verification - Excludes `release/` from extraResources to prevent recursive nesting - Adds startup ABI compatibility check in Electron main process with friendly error dialog instead of cryptic crash Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.1 KiB
YAML
58 lines
1.1 KiB
YAML
appId: com.codepilot.app
|
|
productName: CodePilot
|
|
directories:
|
|
output: release
|
|
files:
|
|
- dist-electron/**/*
|
|
- "!node_modules"
|
|
- "!src"
|
|
- "!electron"
|
|
- "!.next"
|
|
- "!build"
|
|
- "!scripts"
|
|
- "!docs"
|
|
- "!release"
|
|
extraResources:
|
|
- from: .next/standalone/
|
|
to: standalone/
|
|
filter:
|
|
- "**/*"
|
|
- "!node_modules"
|
|
- "!release"
|
|
- from: .next/standalone/node_modules/
|
|
to: standalone/node_modules/
|
|
filter: ["**/*"]
|
|
- from: .next/standalone/.next/
|
|
to: standalone/.next/
|
|
filter: ["**/*"]
|
|
- from: .next/static/
|
|
to: standalone/.next/static/
|
|
filter: ["**/*"]
|
|
- from: public/
|
|
to: standalone/public/
|
|
filter: ["**/*"]
|
|
- from: build/
|
|
to: .
|
|
filter: ["icon.*"]
|
|
afterPack: scripts/after-pack.js
|
|
asarUnpack:
|
|
- "**/*.node"
|
|
- "**/better-sqlite3/**"
|
|
mac:
|
|
icon: build/icon.icns
|
|
category: public.app-category.developer-tools
|
|
target:
|
|
- target: dmg
|
|
arch: [arm64]
|
|
win:
|
|
icon: build/icon.ico
|
|
target:
|
|
- target: nsis
|
|
arch: [x64, arm64]
|
|
nsis:
|
|
oneClick: false
|
|
perMachine: false
|
|
allowToChangeInstallationDirectory: true
|
|
createDesktopShortcut: true
|
|
createStartMenuShortcut: true
|