From 090d5b4522fcd8c0377c09edd7b84ae9b3f81cd3 Mon Sep 17 00:00:00 2001 From: Ian Sutherland Date: Thu, 22 Oct 2020 18:07:07 -0600 Subject: [PATCH] Fix runtime detection in babel preset --- packages/babel-preset-react-app/create.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/babel-preset-react-app/create.js b/packages/babel-preset-react-app/create.js index df2ec31338f..99a930ba470 100644 --- a/packages/babel-preset-react-app/create.js +++ b/packages/babel-preset-react-app/create.js @@ -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 ' + @@ -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],