Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run create-react-app in a certain browser

Is it possible to launch create-react-app App in a certain browser of my choice? Currently, it always runs in the Chrome while I want it to do that in the Chrome Canary. Does anybody know?

like image 907
srgg6701 Avatar asked Aug 25 '18 04:08

srgg6701


People also ask

Does React work on every browser?

React 18 supports all modern browsers (Edge, Firefox, Chrome, Safari, etc). If you support older browsers and devices such as Internet Explorer which do not provide modern browser features natively or have non-compliant implementations, consider including a global polyfill in your bundled application.

Can I run create React app offline?

first time you need to install the CRAO CLI via this command, then after you'il be able to create React apps offline.


1 Answers

You can use BROWSER environment variable to set which browser you wanna open the app in. For example,

BROWSER=firefox yarn start

or

BROWSER=firefox npm start

will open the app in firefox.

So, you can put something like this in your package.json

"scripts": {
  "start": "BROWSER=firefox react-scripts start",
  "build": "react-scripts build && sw-precache --config=sw-precache-config.js",
  "test": "react-scripts test --env=jsdom",

You can read more about it in this pull request thread

like image 95
sudo bangbang Avatar answered Sep 22 '22 16:09

sudo bangbang