diff --git a/src/launcher.ts b/src/launcher.ts index 5233629f..69379af5 100644 --- a/src/launcher.ts +++ b/src/launcher.ts @@ -107,7 +107,7 @@ export default class ElectronLaunchService implements Services.ServiceInstance { * @returns path to the Electron app binary */ export async function detectBinaryPath(pkg: NormalizedReadResult, p = process) { - const appName: string = pkg.packageJson.build?.productName || pkg.packageJson.name; + const appName: string = pkg.packageJson.productName || pkg.packageJson.build?.productName || pkg.packageJson.name; if (!appName) { return undefined; } diff --git a/test/launcher.spec.ts b/test/launcher.spec.ts index 47e19d2d..33c28872 100644 --- a/test/launcher.spec.ts +++ b/test/launcher.spec.ts @@ -503,9 +503,7 @@ describe('detectBinaryPath', () => { { path: pkgJSONPath, packageJson: { - build: { - productName: 'my-app', - }, + productName: 'my-app', devDependencies: { '@electron-forge/cli': '7.0.0-beta.54', }, @@ -554,9 +552,7 @@ describe('detectBinaryPath', () => { { path: pkgJSONPath, packageJson: { - build: { - productName: 'my-app', - }, + productName: 'my-app', devDependencies: { 'electron-builder': '^24.6.4', },