Skip to content

Commit

Permalink
Fix runtime detection in babel preset
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu committed Oct 23, 2020
1 parent 1af9e97 commit 090d5b4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ module.exports = function (api, opts, env) {
);
}

var hasJsxRuntime = Boolean(
api.caller(caller => !!caller && caller.hasJsxRuntime)
);

if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) {
throw new Error(
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' +
Expand Down Expand Up @@ -99,8 +95,8 @@ module.exports = function (api, opts, env) {
development: isEnvDevelopment || isEnvTest,
// Will use the native built-in instead of trying to polyfill
// behavior for any plugins that require one.
...(!hasJsxRuntime ? { useBuiltIns: true } : {}),
runtime: hasJsxRuntime ? 'automatic' : 'classic',
...(opts.runtime !== 'automatic' ? { useBuiltIns: true } : {}),
runtime: opts.runtime || 'classic',
},
],
isTypeScriptEnabled && [require('@babel/preset-typescript').default],
Expand Down

0 comments on commit 090d5b4

Please sign in to comment.