Skip to content

Feature: Support querystring on npm start #1450

Closed

Description

@coryhouse

Some apps need to be started with querystring parameters. So it would be helpful to specify an optional querystring for npm start.

Suggested approach:

 "scripts": {
    "start": "react-scripts start --query=?foo=bar&baz=qux",
   ....

Thoughts?

Activity

  1. gaearon commented on Feb 9, 2017

    @gaearon
    Contributor

    Hmm. Why not set up a redirect in src/index.js if this is absolutely required for the app?

  2. coryhouse commented on Feb 9, 2017

    @coryhouse
    ContributorAuthor

    Interesting. I hadn't considered that. The only downsides I see:

    1. It's harder to find. Start would be the logical place I'd check first.
    2. It would bubble up to all environments which is typically undesirable. Though this can be mitigated by checking the url for localhost so that redirecting only occurs in local dev.

    The use case: App that is normally called from a separate app with required context provided via querystring.

    I have the config above working on a fork of create-react-app, but I had to disable the Apple specific alternative to opn in react-dev-utils/openBrowser because it ignores querystrings.

  3. gaearon commented on Feb 9, 2017

    @gaearon
    Contributor

    I think this is a bit of an unusual use case, and I don't think we'll be supporting this by default.
    Maybe in the future as part of more general "default URL" customization.

  4. gaearon commented on Feb 11, 2017

    @gaearon
    Contributor

    I think I'm going to close this unless there's more support for this being configurable. Since 0.9.0, you can override BROWSER environment variable to disable the default opening behavior (and potentially do something else in a custom script instead):

      "start": "BROWSER=none npm start && node scripts/myOpen.js"
  5. gaearon commented on May 15, 2017

    @gaearon
    Contributor

    Seems like this use case will be fixed by #1590.

  6. locked and limited conversation to collaborators on Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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