To run "npm start" with a specific browser with create-react-app, we set the BROWSER
environment variable.
For instance, in package.json, we write
{
//...
"scripts": {
"start": "BROWSER='chrome' react-scripts start"
}
//...
}
to set the BROWSER
environment variable to 'chrome'
.
And then we run react-scripts start
to start create-react-app with Chrome.
This works on windows.
On Linux, we write
{
//...
"scripts": {
"start": "BROWSER='google-chrome-stable' react-scripts start"
}
//...
}
And on Mac OS, we write
{
//...
"scripts": {
"start": "BROWSER='google chrome' react-scripts start"
}
//...
}