From 8116195605e6baeba5c54cd8cac5d6948cb41015 Mon Sep 17 00:00:00 2001 From: Gabriel Aumala Date: Sat, 3 Dec 2016 22:49:26 -0500 Subject: [PATCH] Configure which browser to open in npm start (#873) Use a 'BROWSER' environment variable with npm start to specify which browser to open. if the value of 'BROWSER' is not valid executable file, don't open any browser. --- packages/react-dev-utils/openBrowser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index bee85a7d299..3cd877a12a7 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -28,7 +28,8 @@ function openBrowser(url) { // Fallback to opn // (It will always open new tab) try { - opn(url).catch(() => {}); // Prevent `unhandledRejection` error. + var option = {app: process.env.BROWSER}; + opn(url, option).catch(() => {}); // Prevent `unhandledRejection` error. return true; } catch (err) { return false;