diff --git a/dev-packages/application-manager/src/rebuild.ts b/dev-packages/application-manager/src/rebuild.ts index 9e6c36550025e..e672e7a6a3b38 100644 --- a/dev-packages/application-manager/src/rebuild.ts +++ b/dev-packages/application-manager/src/rebuild.ts @@ -16,7 +16,6 @@ import fs = require('fs-extra'); import path = require('path'); -import cp = require('child_process'); export function rebuild(target: 'electron' | 'browser', modules: string[]): void { const nodeModulesPath = path.join(process.cwd(), 'node_modules'); @@ -43,12 +42,8 @@ export function rebuild(target: 'electron' | 'browser', modules: string[]): void try { pack.dependencies = Object.assign({}, pack.dependencies, dependencies); fs.writeFileSync(packFile, JSON.stringify(pack, undefined, ' ')); - const electronRebuildPath = path.join(process.cwd(), 'node_modules', '.bin', 'electron-rebuild'); - if (process.platform === 'win32') { - cp.spawnSync('cmd', ['/c', electronRebuildPath]); - } else { - require(electronRebuildPath); - } + const electronRebuildPackageJson = require('electron-rebuild/package.json'); + require(`electron-rebuild/${electronRebuildPackageJson['bin']['electron-rebuild']}`); } finally { setTimeout(() => { fs.writeFile(packFile, packageText);