Closed twchn closed 6 years ago
@taoweicn I don't understand, what's the point?
@taoweicn I don't understand, what's the point?
The code below both are my .babelrc
config.
When I wrote this, it will NOT work in babel7:
{
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
When I wrote this, it will work in both development and production environment:
{
"plugins": ["transform-react-remove-prop-types"]
}
@taoweicn If you don't set NODE_ENV=production or BABEL_ENV=production, it's not a surprise.
For me it works in the same way as @taoweicn has mentioned. I'm using
├── @babel/core@7.2.2
├── babel-plugin-transform-react-remove-prop-types@0.4.24
└── react@16.6.3
and the following .babelrc
configuration:
{
"presets": [
[
"@babel/env",
{
"targets": {
"browsers": ["last 2 versions"]
},
"modules": false,
"useBuiltIns": "entry"
}
],
"@babel/react",
"@babel/flow"
],
"ignore": ["node_modules", "dist"],
"plugins": ["react-hot-loader/babel", "@babel/plugin-proposal-class-properties", "@babel/transform-classes"],
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types", "react-remove-properties"]
},
"development": {
"plugins": ["flow-react-proptypes"]
}
}
}
I also set the environment variable BABEL_ENV
to production
.
I think that you fill find better luck on the Babel side. If you can provide a failing test case, it would help.
I used babel 7 with
.babelrc
and followed the README, but I found it's useless to writein
.babelrc
. However, when I only wrote"plugins": ["transform-react-remove-prop-types"]
, it works in any environment(development & production).