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) => {
258258
259259 // Function to bundle main process and start Electron
260260 const startElectron = ( ) => {
261+ queuedBuilds ++
261262 if ( bundleMainProcess ) {
262263 // Build the main process
263264 const bundle = bundleMain ( {
@@ -333,8 +334,6 @@ module.exports = (api, options) => {
333334 const chokidar = require ( 'chokidar' )
334335 mainProcessWatch . forEach ( file => {
335336 chokidar . watch ( api . resolve ( file ) ) . on ( 'all' , ( ) => {
336- queuedBuilds ++
337-
338337 if ( args . debug ) {
339338 // Rebuild main process
340339 startElectron ( )
@@ -345,10 +344,12 @@ module.exports = (api, options) => {
345344 return
346345 }
347346
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
352353 startElectron ( )
353354 }
354355 } )
You can’t perform that action at this time.
0 commit comments