babel-preset-react-app-new 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/create.js +10 -1
  2. package/package.json +1 -1
package/create.js CHANGED
@@ -20,6 +20,15 @@ const validateBoolOption = (name, value, defaultValue) => {
20
20
  return value;
21
21
  };
22
22
 
23
+ const hasJsxRuntime = (() => {
24
+ try {
25
+ require.resolve('react/jsx-runtime');
26
+ return true;
27
+ } catch {
28
+ return false;
29
+ }
30
+ })();
31
+
23
32
  module.exports = function (api, opts, env) {
24
33
  if (!opts) {
25
34
  opts = {};
@@ -95,7 +104,7 @@ module.exports = function (api, opts, env) {
95
104
  // Will use the native built-in instead of trying to polyfill
96
105
  // behavior for any plugins that require one.
97
106
  ...(opts.runtime !== 'automatic' ? { useBuiltIns: true } : {}),
98
- runtime: opts.runtime || 'classic'
107
+ runtime: opts.runtime || (hasJsxRuntime ? 'automatic' : 'classic')
99
108
  }
100
109
  ],
101
110
  isTypeScriptEnabled && [require('@babel/preset-typescript').default]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-react-app-new",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Babel preset used by Create React App",
5
5
  "repository": {
6
6
  "type": "git",