diff --git a/.changeset/fresh-experts-clap.md b/.changeset/fresh-experts-clap.md new file mode 100644 index 00000000000..dc2dd4edc77 --- /dev/null +++ b/.changeset/fresh-experts-clap.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +fix: Using electron-rebuild for finding project root for native node addons to correctly handle monorepo setups diff --git a/packages/app-builder-lib/src/util/yarn.ts b/packages/app-builder-lib/src/util/yarn.ts index 79ce7b2ad26..19e09669d80 100644 --- a/packages/app-builder-lib/src/util/yarn.ts +++ b/packages/app-builder-lib/src/util/yarn.ts @@ -5,8 +5,9 @@ import { homedir } from "os" import * as path from "path" import { Configuration } from "../configuration" import { NodeModuleDirInfo } from "./packageDependencies" -import * as electronRebuild from "electron-rebuild" import { getElectronVersion } from "../electron/electronVersion" +import * as electronRebuild from "electron-rebuild" +import * as searchModule from "electron-rebuild/lib/src/search-module" export async function installOrRebuild(config: Configuration, appDir: string, options: RebuildOptions, forceInstall = false) { let isDependenciesInstalled = false @@ -156,6 +157,7 @@ export async function rebuild(appDir: string, buildFromSource: boolean, arch = p arch, force: true, debug: log.isDebugEnabled, + projectRootPath: await searchModule.getProjectRootPath(appDir), } if (buildFromSource) { options.prebuildTagPrefix = "totally-not-a-real-prefix-to-force-rebuild"