Create-react-app: start without opening url in browser

Created on 5 Sep 2017  路  6Comments  路  Source: facebook/create-react-app

I'm currently using create-react-app in an electron app without issues. The only discomforting thing is that whenever I start the development server it opens the app in the browser, which I don't need. Is there any way to pass a parameter to tell react-scripts to start the development server without redirecting?

Most helpful comment

Please see Advanced Configuration. You can create a .env file and add BROWSER=none.

All 6 comments

Please see Advanced Configuration. You can create a .env file and add BROWSER=none.

Thanks! And sorry for the inconvenience, didn't catch that.

No problem! I'm on my mobile so I hope I didn't come off too terse.

Let us know if you need any more help. :-)

You can also just write:

BROWSER=none yarn start

This sets the environment variable before running the script

also:
"scripts": { "start": "BROWSER=none react-scripts start" }
In package.json

Note that in Windows, you would have to do set BROWSER=none && react-scripts start but this causes a small error window to pop up saying something along the lines of "couldn't find 'none' browser."

So, if you're running Windows, make a file named '.env' in root directory of project and put BROWSER=none inside of it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adrice727 picture adrice727  路  3Comments

Evan-GK picture Evan-GK  路  3Comments

onelson picture onelson  路  3Comments

oltsa picture oltsa  路  3Comments

Aranir picture Aranir  路  3Comments