Skip to content

Commit 8090457

Browse files
authored
fix: add react-server condition for react/jsx-dev-runtime (#28921)
1 parent 4ddff73 commit 8090457

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export {Fragment, jsxDEV} from './src/jsx/ReactJSXServer';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-jsx-dev-runtime.react-server.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-jsx-dev-runtime.react-server.development.js');
7+
}

packages/react/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"jsx-runtime.js",
1717
"jsx-runtime.react-server.js",
1818
"jsx-dev-runtime.js",
19+
"jsx-dev-runtime.react-server.js",
1920
"react.react-server.js"
2021
],
2122
"main": "index.js",
@@ -29,7 +30,10 @@
2930
"react-server": "./jsx-runtime.react-server.js",
3031
"default": "./jsx-runtime.js"
3132
},
32-
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
33+
"./jsx-dev-runtime": {
34+
"react-server": "./jsx-dev-runtime.react-server.js",
35+
"default": "./jsx-dev-runtime.js"
36+
},
3337
"./src/*": "./src/*"
3438
},
3539
"repository": {

scripts/rollup/bundles.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ const bundles = [
149149
externals: ['react', 'ReactNativeInternalFeatureFlags'],
150150
},
151151

152+
/******* React JSX DEV Runtime React Server *******/
153+
{
154+
bundleTypes: [NODE_DEV, NODE_PROD],
155+
moduleType: ISOMORPHIC,
156+
entry: 'react/src/jsx/ReactJSXServer.js',
157+
name: 'react-jsx-dev-runtime.react-server',
158+
condition: 'react-server',
159+
global: 'JSXDEVRuntime',
160+
minifyWithProdErrorCodes: false,
161+
wrapWithModuleBoundaries: false,
162+
externals: ['react', 'ReactNativeInternalFeatureFlags'],
163+
},
164+
152165
/******* React DOM *******/
153166
{
154167
bundleTypes: [NODE_DEV, NODE_PROD],

0 commit comments

Comments
 (0)