Skip to content

Setup BABEL_ENV for Webpack2 via loader  #283

Closed
@nodkz

Description

@nodkz

Need the ability to pass the desired environment name to babel via babel-loader.

I have such .babelrc:

{
  "presets": [
    "es2015",
    "stage-0",
    "react"
  ],
  "env": {
    "webpack2": {
      "presets": [
        ["es2015", {"modules": false}],
        "stage-0",
        "react"
      ],
    }
  }
}

I'm starting webpack via run script which written with es6 modules. But if I start script with BABEL_ENV=webpack2 then it requires rewriting all scripts to commonjs style.

Furthermore I should rewrite all app, cause use Relay with babelRelayPlugin.

So the better way to use Webpack2 with passing env value via babel-loader settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions