diff --git a/scripts/watch-demo b/scripts/watch-demo index a734f4d315..948289c18b 100755 --- a/scripts/watch-demo +++ b/scripts/watch-demo @@ -26,12 +26,17 @@ const watchify = spawn(cmd, [startTsFilePath, '-p', '[tsify]', '-v', '--debug', watchify.stdout.pipe(process.stdout); watchify.stderr.pipe(process.stderr); +let httpServerStarted = false; + console.log('Waiting for initial compile...'); watchify.stderr.on('data', (data) => { if (data.toString().includes(`written to ${path.dirname(startTsFilePath)}`)) { - const httpCmd = path.join('node_modules', '.bin', 'http-server'); - const httpServer = spawn(httpCmd, ['-c-1'], { detached: false}); - httpServer.stdout.pipe(process.stdout); - httpServer.stderr.pipe(process.stderr); + if (!httpServerStarted) { + const httpCmd = path.join('node_modules', '.bin', 'http-server'); + const httpServer = spawn(httpCmd, ['-c-1'], { detached: false}); + httpServer.stdout.pipe(process.stdout); + httpServer.stderr.pipe(process.stderr); + httpServerStarted = true; + } } });