score:3
as i read on the script that runs when you run npm start, you may set an environment variable called browser before running the npm start
for example (on linux):
(export browser=firefox; npm start)
also, you may open the browsers after starting:
npm start &
firefox http://localhost:3000
safari http://localhost:3000
save it to a something.sh and run this shell script. if you are on windows, you may do something similar on .bat script
score:3
you can install global node package called opn-cli then you can run the command. https://www.npmjs.com/package/opn-cli
sample command:
npm start & opn http://localhost:4200 -- firefox & opn http://localhost:4200 -- chrome
score:9
create an environment file .env
at the root of the project directory and add following entry
browser=firefox
for a complete list of .env
file configuration, you can check here - https://facebook.github.io/create-react-app/docs/advanced-configuration
Source: stackoverflow.com
Related Query
- how to open non default browsers when doing npm start for a react project
- My npm start for react tutorial project is not working
- how to mock npm uniqid for react unit test when using Jest?
- How to get React Project to work Because NPM Start Wont Work
- How to specify (optional) default props with TypeScript for stateless, functional React components?
- Issue with babel-jest dependency when running npm start in a React app
- React tutorial - how do I start the node server for a reactJs application?
- Missing Script when I run npm start to create React app
- How to update webpack config for a react project created using create-react-app?
- How to set React default props for object type
- How do I simulate browser events when writing tests for React js?
- How to add global loading/spin effect in axios interceptor for a React project
- React Navigation: How to update navigation title for parent, when value comes from redux and gets updated in child?
- CDN links for React packages and how to import it when using react using the scripts from CDN
- How to change default localhost port for React App
- How to trigger hot reloading for React when a package in node_modules is changed?
- How to enable TypeScript intellisense in VSCode for a codebase in JavaScript when doing module augmentation for a third-party library?
- React Native start failed with error code -4094 how to solve this ONCE for ALL?
- How do I get my React TextField to open the number pad when inputting on a mobile device?
- How to specify a key for React children when mapping over an array
- How to auto install npm modules when I build ASP.NET Core project
- React npm error “npm ERR! code ELIFECYCLE” when I do npm start
- unable to run npm start for react-native project
- ReactJS - How can I implement pagination for react with keep state when route change?
- How to start animation when props change (via redux) in React Native?
- Webpack: npm start "Module not found: Error: Can't resolve ..." after moving location for webpack / react files
- npm start command not working, when I try to run my React application
- React App: Why I get an error when I try to run npm start script?
- How do I set a default value for a select menu in my React form component?
- How do I open a React Native Android deeplink when the app is open in the background?
More Query from same tag
- How to secure your data using .env?
- TypeError: Cannot read property '0' of undefined dataExtracting
- Change React component visibility based on the state of another component
- How to download a Docx file or msWord file using reactjs?
- Cannot access redux object array property
- Reactjs - My redux is not storing the user
- Why useRef value dynamically updates when it is an integer but stores the previous value when it is a string?
- Child component returns props as null
- Want to generate unique numeric id , can't use node-uuid since backend is expecting numeric id
- Exporting / Importing a Const from a React Component
- Random number using React.js
- Arrow functions in class throw error with webpack-encore
- How to apply Formik with Chakra in typescript?
- Find object in state and update property
- How to import everything from a module in react using es6?
- Framer motion error after install the package and import
- How to dynamically change displayed image using React and Parceljs?
- React Context and Storybook: Changing value of a React Context inside a component story
- Can React animate a component being hidden/removed?
- Style problems with higher order component & Material-UI's makeStyles
- Setting a field directly on the class definition in ReactJS
- Webpack2 custom module resolve error
- Custom react hook throwing error "React has detected a change in the order of Hooks called by ProvidePlaidLink."
- change the filled color of an SVG image in react
- How to populate img src with event.target.files before saving image to server
- React - call parent method in child component after passing it
- Having issue with defining path for image in a react application
- Issue with Material-UI Select onChange
- react-draft-wysiwyg Default Value Style doesn't load
- Webpack automatically require a file in all files...?