Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !11878

fix: browser selection via env variable

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/FloydJohn/fix-browser-env into main Jan 03, 2022
  • Overview 17
  • Commits 3
  • Pipelines 0
  • Changes 1

Created by: FloydJohn

Hi everyone,

this PR fixes the opening of a browser of choice, selected through the BROWSER environment variable, when starting a generated project.

After migrating to CRA v5.x the feature stopped working (see #11873, #11844, #11942, #11917, #12275).

Browsing the documentation for the open@8.4.0 package (available here) I noticed that the syntax for opening an URL using a specified browser was updated.

This PR includes two small changes:

  • The updated syntax for opening a browser is now used
  • Since the open package natively supports passing an array of arguments to the application, we no longer need to concatenate the arguments before the call

To test this feature I followed this test plan:

  • Create a new .env file in the template project, containing for example the value BROWSER=google-chrome-stable. The browser name could change based on OS or linux distro.
  • Start the template project with npm run start. A new tab should open in the specified browser.
  • Stop the process and remove the newly created .env file.
  • Start again the project with npm run start: it should open on the default browser.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/FloydJohn/fix-browser-env