diff --git a/README.md b/README.md index c886f37..5112ea5 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,12 @@ You may override our default debug option by providing your own `debug` key. } ``` +## React Development Mode + +When the `envName` for `babel` is `development`, [the `develoment` mode will be set for `@babel/preset-react`](https://babeljs.io/docs/en/babel-preset-react#development). + +To override this, set the `devEnv` option to a value that [`api.env`](https://babeljs.io/docs/en/next/config-files#apienv) accepts. + ## React PropTypes removal This preset can be configured to remove propTypes using [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) with the following default options: diff --git a/index.js b/index.js index dd53c8c..c1d8474 100644 --- a/index.js +++ b/index.js @@ -22,6 +22,8 @@ module.exports = declare((api, options) => { const debug = (options && typeof options.debug === 'boolean') ? !!options.debug : false; + const { devEnv = 'development' } = options || {}; + api.assertVersion(7); return { @@ -36,7 +38,7 @@ module.exports = declare((api, options) => { modules: options.modules, targets: transpileTargets, }], - [require('@babel/preset-react'), { development: api.env('development') }], + [require('@babel/preset-react'), { development: api.env(devEnv) }], ], plugins: [ options && !!options.removePropTypes ? ['babel-plugin-transform-react-remove-prop-types', assign({