fix: skip cpu-features electron rebuild

This commit is contained in:
Jinwoo Hong 2026-05-30 16:35:18 -04:00 committed by GitHub
parent 8d9b518091
commit 2609ca2bc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 8 deletions

View File

@ -11,12 +11,10 @@
* postinstall step to fail and prevents `pnpm install` from completing.
*
* This script replaces `electron-builder install-app-deps` in the postinstall
* lifecycle. It calls @electron/rebuild's JS API directly so that we can pass
* `ignoreModules: ['cpu-features']` on Windows. Skipping cpu-features is
* safe: ssh2 detects the missing native module and falls back to pure-JS CPU
* feature detection automatically.
*
* On macOS and Linux the full rebuild (including cpu-features) runs as usual.
* lifecycle. It calls @electron/rebuild's JS API directly so that we can skip
* `cpu-features` when rebuilding modules against Electron. Skipping
* cpu-features is safe: ssh2 detects the missing native module and falls back
* to pure-JS CPU feature detection automatically.
*/
import { rebuild } from '@electron/rebuild'
@ -31,10 +29,10 @@ const electronVersion = JSON.parse(
readFileSync(resolve(electronPackageDir, 'package.json'), 'utf8')
).version
const ignoreModules = process.platform === 'win32' ? ['cpu-features'] : []
const ignoreModules = ['cpu-features']
if (ignoreModules.length > 0) {
console.log(`[rebuild] Skipping modules on Windows: ${ignoreModules.join(', ')}`)
console.log(`[rebuild] Skipping optional Electron rebuild modules: ${ignoreModules.join(', ')}`)
}
// Why: @electron/rebuild's default module walker doesn't reliably find native