Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise(async (resolve, reject) => {
// Use custom config for webpack
process.env.IS_ELECTRON = true
const builder = require('electron-builder')
const yargs = require('yargs')
// Import the yargs options from electron-builder
const configureBuildCommand = require('electron-builder/out/builder')
.configureBuildCommand
// Prevent custom args from interfering with electron-builder
removeArg('--mode', 2, rawArgs)
removeArg('--dest', 2, rawArgs)
removeArg('--legacy', 1, rawArgs)
removeArg('--dashboard', 1, rawArgs)
removeArg('--skipBundle', 1, rawArgs)
removeArg('--report', 1, rawArgs)
removeArg('--report-json', 1, rawArgs)
// Parse the raw arguments using electron-builder yargs config
const builderArgs = yargs
.command(['build', '*'], 'Build', configureBuildCommand)
.parse(rawArgs)
// Base config used in electron-builder build
const outputDir =
args.dest || pluginOptions.outputDir || 'dist_electron'