File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,7 @@ module.exports = (api, options) => {
258
258
259
259
// Function to bundle main process and start Electron
260
260
const startElectron = ( ) => {
261
+ queuedBuilds ++
261
262
if ( bundleMainProcess ) {
262
263
// Build the main process
263
264
const bundle = bundleMain ( {
@@ -333,8 +334,6 @@ module.exports = (api, options) => {
333
334
const chokidar = require ( 'chokidar' )
334
335
mainProcessWatch . forEach ( file => {
335
336
chokidar . watch ( api . resolve ( file ) ) . on ( 'all' , ( ) => {
336
- queuedBuilds ++
337
-
338
337
if ( args . debug ) {
339
338
// Rebuild main process
340
339
startElectron ( )
@@ -345,10 +344,12 @@ module.exports = (api, options) => {
345
344
return
346
345
}
347
346
348
- // Set auto restart flag
349
- childRestartOnExit = 1
350
- if ( child ) {
351
- // Start Electron if it hasn't been already launched
347
+ // Chokidar calls this on initial launch,
348
+ // so don't do anything if Electron hasn't been launched yet
349
+ if ( child || childRestartOnExit === 1 ) {
350
+ // Set auto restart flag
351
+ childRestartOnExit = 1
352
+ // Start Electron
352
353
startElectron ( )
353
354
}
354
355
} )
You can’t perform that action at this time.
0 commit comments