csepulv / electron-with-create-react-app

Sample Electron application using create-react-app
MIT License
831 stars 217 forks source link

Running last version of react-scripts will cause to launch the app in both Browser and Electron window #26

Open Calandal95 opened 5 years ago

Calandal95 commented 5 years ago

Hi, i was updating the app to the latest versions of the packages- Everything was fine until i updated the react-scripts package to the last version (2.1.3). Now running yarn dev will cause to launch the app in the browser and lately in the electron window. Any idea on how to fix it?

csepulv commented 5 years ago

Unfortunately I don't know. I haven't had a chance to update versions of the package dependencies.

dascoder commented 5 years ago

I found a fix for this. In package.json under scripts change "start": "react-scripts start", to "start": "SET BROWSER=none&&react-scripts start", . That's what worked for me. Note that the lack of spacing is intentional. Reference from https://github.com/facebook/create-react-app/issues/873#issuecomment-396803278

jamieweavis commented 5 years ago

As per this comment, you can also create a .env file in the root of your project with BROWSER=none as the contents - this works perfectly and is a little bit nicer than setting the BROWSER variable in the start script! 😄