Browser React

Create React App: Specify the browser behaviour on running npm start

The Create React App framework is configured to open the default system browser while running the npm start command using react-scripts. But you are able to define a custom browser type and override the default behaviour while running your app. Alternativly we are able to disable thee automatic browser start completely.

Specifing a custom browser

To customize the browser that is launched we have to specify a we have to define a environemnt variable. The variable itself is called 'BROWSER' and must be set to the name of the browser we wish to start. For example you can set it to chrome, edge,or safari.

Specify the browser on demand

To set the variable on demand while starting your app you simply set the variable infront of the default start command:

BROWSER=chrome npm start

Permanently set the browser type for your react app

To set the preffered browser on a long term basis you hve to create a .env file at the root location of your project and add the following line using your browser:

BROWSER=chrome

Disabling the automatic browser start

To disable the browser start completely, you have to set the variable as follows:

BROWSER=none

Source

Create React App - Advanced Configuration

{{ message }}

{{ 'Comments are closed.' | trans }}