Use modern JSX runtime in Flight fixture (#35677)
Sebastian "Sebbie" Silbermann committed
Feb 3, 2026 at 12:05 UTC
748ee74e22ab86994c12564a19fc73950d00ad72
9 files changed
+3
-26
fixtures/flight/config/webpack.config.js
+1
-14
@@ -76,19 +76,6 @@ const cssModuleRegex = /\.module\.css$/;
76
const sassRegex = /\.(scss|sass)$/;
77
const sassModuleRegex = /\.module\.(scss|sass)$/;
78
79
-const hasJsxRuntime = (() => {
80
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
81
- return false;
82
- }
83
-
84
- try {
85
- require.resolve('react/jsx-runtime');
86
- return true;
87
- } catch (e) {
88
- return false;
89
- }
90
-})();
91
-
79
// This is the production and development configuration.
80
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
81
module.exports = function (webpackEnv) {
@@ -425,7 +412,7 @@ module.exports = function (webpackEnv) {
412
[
413
require.resolve('babel-preset-react-app'),
414
{
428
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
415
+ runtime: 'automatic',
416
},
417
],
418
],
fixtures/flight/loader/global.js
+1
-1
@@ -5,7 +5,7 @@ const babelOptions = {
5
ignore: [/\/(build|node_modules)\//],
6
plugins: [
7
'@babel/plugin-syntax-import-meta',
8
- '@babel/plugin-transform-react-jsx',
8
+ ['@babel/plugin-transform-react-jsx', {runtime: 'automatic'}],
9
],
10
};
11
fixtures/flight/loader/region.js
+1
-1
@@ -14,7 +14,7 @@ const babelOptions = {
14
ignore: [/\/(build|node_modules)\//],
15
plugins: [
16
'@babel/plugin-syntax-import-meta',
17
- '@babel/plugin-transform-react-jsx',
17
+ ['@babel/plugin-transform-react-jsx', {runtime: 'automatic'}],
18
],
19
sourceMaps: process.env.NODE_ENV === 'development' ? 'inline' : false,
20
};
fixtures/flight/src/Button.js
-1
@@ -1,6 +1,5 @@
1
'use client';
2
3
-import * as React from 'react';
3
import {useFormStatus} from 'react-dom';
4
import ErrorBoundary from './ErrorBoundary.js';
5
fixtures/flight/src/Container.js
-2
@@ -1,5 +1,3 @@
1
-import * as React from 'react';
2
-
1
export default function Container({children}) {
2
return <div>{children}</div>;
3
}
fixtures/flight/src/Dynamic.js
-2
@@ -1,7 +1,5 @@
1
'use client';
2
3
-import * as React from 'react';
4
-
3
export function Dynamic() {
4
return (
5
<div>
fixtures/flight/src/GenerateImage.js
-2
@@ -1,5 +1,3 @@
1
-import * as React from 'react';
2
-
1
import {createCanvas} from 'canvas';
2
3
export async function GenerateImage({message}) {
fixtures/flight/src/LargeContent.js
-2
@@ -1,5 +1,3 @@
1
-import * as React from 'react';
2
-
1
export default async function LargeContent() {
2
return (
3
<div>
fixtures/flight/src/index.js
-1
@@ -1,4 +1,3 @@
1
-import * as React from 'react';
1
import {use, Suspense, useState, startTransition, Profiler} from 'react';
2
import ReactDOM from 'react-dom/client';
3
import {createFromFetch, encodeReply} from 'react-server-dom-webpack/client';