-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRi: discussionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Milestone
Description
## EDIT: We're just going to deprecate now
Fixing merge behavior instead
Original issue details:
Details
http://babeljs.io/docs/usage/babelrc/#env-optionsome env issues: #5275, #4539, #4013, #4817
{
"env": {
"production": {
"plugins": ["transform-react-constant-elements"]
}
}
}Options specific to a certain environment are merged into and overwrite non-env specific options.
The env key will be taken from process.env.BABEL_ENV, when this is not available then it uses process.env.NODE_ENV if even that is not available then it defaults to "development".
- remove the merge behavior (each env needs to specify every config value again)
- drop the env option entirely and recommend using
.babelrc.jsusing a combiation of ternaries + process.env manually (Add support for .babelrc.js files #4892) - only allow a development, production, profiling env options https://twitter.com/dan_abramov/status/828997631561039872
- remove development as the default environment
// transformReactJSXSource, - better validation from babel's side if plugins/presets use env
- ?
true that allowing .js may lead to crazy configs but think it's better than confusing with babelrc/env
Because it's JS you could do this in a lot of ways
var env = process.env.BABEL_ENV || process.env.NODE_ENV;// inline plugin
module.exports = {
plugins: [
env === 'development' && "transform-react-constant-elements"
].filter(Boolean)
};var plugins = [];
if (env === 'development') {
plugins.push.apply(plugins, ["transform-react-constant-elements"]);
}
module.exports = { plugins };Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRi: discussionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue