Skip to content

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

Closed

Description

@rgdelato

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)?

Activity

  1. Timer commented on Jan 24, 2017

    @Timer
    Contributor

    Related #1415

  2. rgdelato commented on Jan 25, 2017

    @rgdelato
    Author

    @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
          }
        }]
      ]
    }
  3. gaearon commented on Feb 9, 2017

    @gaearon
    Contributor

    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.

  4. locked and limited conversation to collaborators on Jan 22, 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