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?
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.
Most helpful comment
Please see Advanced Configuration. You can create a .env file and add BROWSER=none.