Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support querystring on npm start #1450

Closed
coryhouse opened this issue Jan 25, 2017 · 5 comments
Closed

Feature: Support querystring on npm start #1450

coryhouse opened this issue Jan 25, 2017 · 5 comments

Comments

@coryhouse
Copy link
Contributor

coryhouse commented Jan 25, 2017

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?

@gaearon
Copy link
Contributor

gaearon commented Feb 9, 2017

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

@coryhouse
Copy link
Contributor Author

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.

@gaearon
Copy link
Contributor

gaearon commented Feb 9, 2017

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.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

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"

@gaearon
Copy link
Contributor

gaearon commented May 15, 2017

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

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants