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

Allow passing options to babel-preset-react-app #1442

Closed
rgdelato opened this issue Jan 24, 2017 · 3 comments
Closed

Allow passing options to babel-preset-react-app #1442

rgdelato opened this issue Jan 24, 2017 · 3 comments

Comments

@rgdelato
Copy link

rgdelato commented Jan 24, 2017

I'm using babel-preset-react-app outside of create-react-app, and I'd like to be able to pass options down to the underlying Babel modules that are being used. For example, maybe something like:

{
  "presets": [
    ["react-app", {
      "latest": {
        "es2015": {
          "modules": false
        }
      }
    }]
  ]
}

...to pass a config object to babel-preset-latest. I understand that CRA has a general aversion to adding configuration, so I wanted to ask if this seemed like a reasonable addition (since the options won't actually be exposed to users of CRA)?

@Timer
Copy link
Contributor

Timer commented Jan 24, 2017

Related #1415

@rgdelato
Copy link
Author

rgdelato commented Jan 25, 2017

@Timer @sheerun

I think it'd be better to do this for all of the included babel presets rather than just for babel-preset-env, so maybe it'd be better if #1415 placed its corresponding config underneath an env key to allow for other preset configurations, like this:

{
  "presets": [
    ["react-app", {
      "env": {
        "targets": {
          "chrome": 52,
          "browsers": "last 2 safari versions"
        },
        "loose": true,
        "modules": false
      },
      "some-other-preset": {
        "some-other-preset-setting": true
      }
    }]
  ]
}

@gaearon
Copy link
Contributor

gaearon commented Feb 9, 2017

I would like to keep the Babel preset very strict right now to prevent combinatorial explosion of potential options (and thus issues reported). We will definitely support passing the browsers in the future, but this will be a part of #1249. Closing for now.

@gaearon gaearon closed this as completed Feb 9, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 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

3 participants