Create-react-app: Add flag to react-scripts to suppress auto-opening `localhost:3000`

Created on 4 May 2017  Â·  7Comments  Â·  Source: facebook/create-react-app

Auto-opening the browser tab can get really annoying in certain situations.

  • Sometimes I already have the window open and would prefer to just reload the tab.

  • Other times I'm testing another browser and don't want to keep opening my default browser.

  • Sometimes I need to open a custom URL. In my latest project, I need to add a query string to use the staging server instead of the production server. With the suppression flag, I could change my start script to: react-scripts start --no-open-browser; open localhost:3000?useapi=production

question

Most helpful comment

You can run BROWSER=none npm start or create an .env file with BROWSER=none in it to prevent the browser from opening.

Let us know if you need help with anything else!

All 7 comments

You can run BROWSER=none npm start or create an .env file with BROWSER=none in it to prevent the browser from opening.

Let us know if you need help with anything else!

What exactly does the script do? I haven't had time to even look at it tbh.

On Thu, May 4, 2017 at 9:36 PM, Joe Haddad notifications@github.com wrote:

You can run BROWSER=none npm start or create an .env file with
BROWSER=none in it to prevent the browser from opening.

Let us know if you need help with anything else!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/create-react-app/issues/2084#issuecomment-299357398,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXnF2CDsfqBcnqiyrdJgQpHoc1aihRxQks5r2osdgaJpZM4NQ-AK
.

Thank you @Timer! That's exactly what I needed.

Was that documented somewhere? I tried to look around first but I could have missed it.

Sometimes I already have the window open and would prefer to just reload the tab.

This is exactly what it should do on OS X. Unfortunately it’s not possible on other systems 😞

Somehow it doesn't do that for me, and I have the latest OS X. Maybe because I'm using Firefox?

Yeah, our tab reloading only works for Chrome (sorry!).
If you're familiar with AppleScript, you can try to contribute Firefox support!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexeyRyashencev picture AlexeyRyashencev  Â·  3Comments

alleroux picture alleroux  Â·  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  Â·  3Comments

jnachtigall picture jnachtigall  Â·  3Comments

stopachka picture stopachka  Â·  3Comments