Babylon plug-in documents say that:
- Plugins run before presets.
- Ordering a plugin will last primarily.
- Preset ordering is canceled (first to first).
The babel . babelrc docs say that:
Environment-specific parameters are combined and replaced with non-standard parameters.
Documents do not say exactly how they are combined.
I am using the React react-slingshot template project, and I want to use the conversion of class properties. The project uses babel-preset-stage-1
, which includes babel-plugin-transform-class-properties
. Converting class properties should allow me to write code as follows:
class Example extends Component { static propTypes = { ... } }
.babelrc
in this project:
{ "presets": [ "react", "stage-1" ], "env": { "development": { "presets": [ "latest", "react-hmre" ] }, "production": { "presets": [ ["latest", { "es2015": { "modules": false } }] ], "plugins": [ "transform-react-constant-elements", "transform-react-remove-prop-types" ] }, "test": { "presets": [ "latest" ] } } }
But when using this as is, I get:
Module build failed: SyntaxError: Missing class properties transform. 5 | class Example extends Component { > 6 | static propTypes = { | ^ 7 | ... 8 | } 9 |
There is a conversion of class properties, but apparently the order is not in order.
I got it to compile without any errors by manually merging non-env presets in env presets, but now there are a lot of repetitions:
{ "env": { "development": { "presets": [ "latest", "react-hmre", "stage-1", "react" ] }, "production": { "presets": [ ["latest", { "es2015": { "modules": false } }], "stage-1", "react" ], "plugins": [ "transform-react-constant-elements", "transform-react-remove-prop-types" ] }, "test": { "presets": [ "latest", "stage-1", "react" ] } } }
Is it possible to specify the order of plugins when using the env and non-env options?