From d3837144f6a2c1d2a3c640b693a4bc5f5ba6cd57 Mon Sep 17 00:00:00 2001 From: Marinin Tim <mt@marinin.xyz> Date: Sat, 10 Sep 2016 16:11:40 +0300 Subject: [PATCH] feat: Add --no-open-browser cli option This option allows to inhibit creating new browser tab/window. --- scripts/start.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/start.js b/scripts/start.js index a1d984017f8..8e5a9a627c7 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -42,6 +42,8 @@ if (isSmokeTest) { }; } +var shouldOpenBrowser = !process.argv.some(arg => arg.indexOf('--no-open-browser') > -1) + // Some custom utilities to prettify Webpack output. // This is a little hacky. // It would be easier if webpack provided a rich error object. @@ -298,7 +300,9 @@ function runDevServer(port, protocol) { clearConsole(); console.log(chalk.cyan('Starting the development server...')); console.log(); - openBrowser(port, protocol); + if (shouldOpenBrowser) { + openBrowser(port, protocol); + } }); }