Skip to content

Commit

Permalink
Add allowESModules option to babel-preset-react-app (#5487)
Browse files Browse the repository at this point in the history
* Add allowESModules option to babel-preset-react-app

* changes after feedback

* Apply suggestions from code review

Co-Authored-By: Pajn <[email protected]>
  • Loading branch information
Pajn authored and Timer committed Nov 21, 2018
1 parent fb465a3 commit a5ea56a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ module.exports = function(api, opts, env) {
var isEnvProduction = env === 'production';
var isEnvTest = env === 'test';

var useESModules = validateBoolOption(
'useESModules',
opts.useESModules,
isEnvDevelopment || isEnvProduction
);
var isFlowEnabled = validateBoolOption('flow', opts.flow, true);
var isTypeScriptEnabled = validateBoolOption(
'typescript',
Expand Down Expand Up @@ -151,7 +156,7 @@ module.exports = function(api, opts, env) {
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
// We should turn this on once the lowest version of Node LTS
// supports ES Modules.
useESModules: isEnvDevelopment || isEnvProduction,
useESModules,
// Undocumented option that lets us encapsulate our runtime, ensuring
// the correct version is used
// https://github.com/babel/babel/blob/090c364a90fe73d36a30707fc612ce037bdbbb24/packages/babel-plugin-transform-runtime/src/index.js#L35-L42
Expand Down

0 comments on commit a5ea56a

Please sign in to comment.