When you install and run create-react-app it normally opens with default browser of your operating system. What if you want to open it with some other browser?
Let’s say your default browser is Internet Explorer and you want create-react-app should automatically opens in Google Chrome browser when you hit npm start command. Here are the steps you need to perform for the same.
We hope that you have already installed create-react-app. Let’s start with steps.
Step 1 : Open create-react-app and Click on new file
Open create-react-app application in the VS code and click on new file button as shown below.
Step 2: Give File a Name .env
File which you have added name it .env ONLY. This is environment variable file. See the below highlighted file in the picture.
Step 3: Add Browser Code
As you have default browser IE and you want to run application on Google Chrome browser then you should add Chrome browser code inside this file. It will override default browser when you run this application.
Add below code in the .env file. Save it and hit npm start. You can see now application gets opened in Chrome browser.