Skip to content

Option to override Chrome when starting dev server #8366

Description

@handeyeco

Is your proposal related to a problem?

From the docs:

By default, Create React App will open the default system browser, favoring Chrome on macOS.

This doesn't really make sense; it either opens the default browser or it doesn't. For example, if:

  1. I have Firefox and Chrome open
  2. Firefox is my default browser
  3. I run npm start
  4. CRA will open the app in Chrome

Describe the solution you'd like

I think what openChrome.applescript does is amazing for people who use Chrome. It's logical that this should be the default.

What I propose is allowing the user to bypass the openChrome.applescript with a environment variable similar to what y'all are doing with BROWSER=none. I already have working changes that I could submit as a PR. It:

  1. Allows users to specify BROWSER=default in .env
  2. Sets shouldTryOpenChromeWithAppleScript to false if BROWSER is default
  3. Returns BROWSER to undefined so the rest of openBroswer.js can do its thing (opening in the default browser)

Describe alternatives you've considered

I thought about changing openChrome.applescript to make it do the same thing with Firefox as it does with Chrome, unfortunately FF doesn't have as good of support as Chrome for AppleScripts.

The only other thought I had was to modify shouldTryOpenChromeWithAppleScript to check what the OS default browser is, but I'm not sure if that's possible.

I figure my suggestion would be the least invasive, allowing people to opt-in to this behavior.

Additional context

Not really sure if there's anything else. Let me know if you'd like me to submit this as a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions