简体   繁体   中英

Expo: Default browser for expo start

Is there a way to change the browser in which the Expo interface ( http://localhost:19002/ ) opens after expo start ?

My default browser is Firefox, which I use for my private life. My work and coding browser is Chrome. Is there a way to tell Expo to use Chrome by default?

React native use chrome and chrome-debug-tool, because firefox's devtool is the big garbage. I recommend you to use chrome when you develop app by expo.

expo start looks at the BROWSER environment variable before using the default browser so you can switch to Chrome just by setting that env var before calling expo start

As a raw command it looks like this for Windows:

set BROWSER=%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe && expo start

For my workflow I have just updated package.json so the yarn run start script does it for me:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "set BROWSER=%ProgramFiles(x86)%\\Google\\Chrome\\Application\\chrome.exe && expo start",
    ...
  },
  ...
}

最简单的方法是复制您的“http://localhost:19002/”并将其粘贴到您要打开项目的浏览器中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM