Skip to content

Allow fine-grained use of env (T7005) #4013

@babel-bot

Description

@babel-bot

Issue originally made by @flying-sheep

Bug information

  • Babel version: 6.4.0
  • Node version: 5.4.1
  • npm version: 3.5.3

Options

Hi, in [[ https://github.com/rackt/react-redux/pull/256#issuecomment-172897156 | this bug ]], i discovered that

  # the env option is not very intuitive
  # the docs don’t explain it
  # it seems to be impossible to have both plugins and presets active in every env and some that are only in a specific one

i’d like to have as little repetition as possible, so i expect the following .babelrc to basically mean

> use the presets **stage-0** and **react** and the plugin **transform-decorators-legacy**.
> 
> if $BABEL_ENV or $NODE_ENV are set to “buildmodule”, additionally use the preset **es2015-loose-rollup**
> 
> if $BABEL_ENV and $NODE_ENV are unset or one is set to “development”, additionally use the preset **es2015-loose**

but this doesn’t seem to be the case. see the linked github issue for what other combinations didn’t work as expected

Input code

{
  "env": {
    "development": {
      "presets": ["es2015-loose"]
    },
    "buildmodule": {
      "presets": ["es2015-loose-rollup"]
    }
  },
  "presets": ["stage-0", "react"],
  "plugins": ["transform-decorators-legacy"]
}

Description

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: questionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions