Skip to content

How to use it with multiple environments in babel-env? #198

@ghost

Description

My .babelrc has 2 environments that are used for differential serving:

"env": {
  "modern": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "targets": {
            "esmodules": true
          }
        }
      ],
      "@babel/preset-react",
      "@babel/preset-flow"
    ],
    "plugins": [...],
  },
  "legacy": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "targets": {
            "esmodules": false
          }
        }
      ],
      "@babel/preset-react",
      "@babel/preset-flow"
    ],
    "plugins": [...],
  }
}

These can be selected using the BABEL_ENV flag. Since either modern or legacy is selected I can't just add another environment (production) because two environments cannot be selected at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions