@samitouri / QOS-React / commits / 8090457c77

fix: add `react-server` condition for `react/jsx-dev-runtime` (#28921)

Alex Yang committed Apr 27, 2024 at 14:45 UTC 8090457c77573f3916df136d582d5f44040da043
4 files changed +35 -1
packages/react/jsx-dev-runtime.react-server.js new
+10
@@ -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';
packages/react/npm/jsx-dev-runtime.react-server.js new
+7
@@ -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
+5 -1
@@ -16,6 +16,7 @@
16 "jsx-runtime.js",
17 "jsx-runtime.react-server.js",
18 "jsx-dev-runtime.js",
19 + "jsx-dev-runtime.react-server.js",
20 "react.react-server.js"
21 ],
22 "main": "index.js",
@@ -29,7 +30,10 @@
30 "react-server": "./jsx-runtime.react-server.js",
31 "default": "./jsx-runtime.js"
32 },
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 + },
37 "./src/*": "./src/*"
38 },
39 "repository": {
scripts/rollup/bundles.js
+13
@@ -149,6 +149,19 @@ const bundles = [
149 externals: ['react', 'ReactNativeInternalFeatureFlags'],
150 },
151
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 +
165 /******* React DOM *******/
166 {
167 bundleTypes: [NODE_DEV, NODE_PROD],