Search code examples
reactjscreate-react-appmicrosoft-edge

How can I start my app in CRA and have it open with the Edge browser?


I have a project in CRA. I am using Windows 10 and my default browser is Firefox. I would like my project to start with the Microsoft Edge browser and not with Firefox. I have used a line like this in the package.json script to open with Chrome and it works:

"start: react": "cross-env BROWSER = chrome react-scripts start",

But if I put this for Edge it doesn't work for me:

"start: react": "cross-env BROWSER = edge react-scripts start",

Is there a way to make it work?


Solution

  • Problem solved: The detail was that I placed the script line in the following way using the browser name "edge":

    "start: react": "cross-env BROWSER = edge react-scripts start",
    

    But the name of the browser is "msedge". In this way the script line looks like this:

    "start: react": "cross-env BROWSER = msedge react-scripts start",
    

    This way it works properly.