Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/react/jsx-dev-runtime.react-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {Fragment, jsxDEV} from './src/jsx/ReactJSXServer';
7 changes: 7 additions & 0 deletions packages/react/npm/jsx-dev-runtime.react-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-jsx-dev-runtime.react-server.production.min.js');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just spotted this. We no longer ship minified so I'll need to follow-up on this one: #28939

} else {
module.exports = require('./cjs/react-jsx-dev-runtime.react-server.development.js');
}
6 changes: 5 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"jsx-runtime.js",
"jsx-runtime.react-server.js",
"jsx-dev-runtime.js",
"jsx-dev-runtime.react-server.js",
"react.react-server.js"
],
"main": "index.js",
Expand All @@ -29,7 +30,10 @@
"react-server": "./jsx-runtime.react-server.js",
"default": "./jsx-runtime.js"
},
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
"./jsx-dev-runtime": {
"react-server": "./jsx-dev-runtime.react-server.js",
"default": "./jsx-dev-runtime.js"
},
"./src/*": "./src/*"
},
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ const bundles = [
externals: ['react', 'ReactNativeInternalFeatureFlags'],
},

/******* React JSX DEV Runtime React Server *******/
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: ISOMORPHIC,
entry: 'react/src/jsx/ReactJSXServer.js',
name: 'react-jsx-dev-runtime.react-server',
condition: 'react-server',
global: 'JSXDEVRuntime',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'ReactNativeInternalFeatureFlags'],
},

/******* React DOM *******/
{
bundleTypes: [NODE_DEV, NODE_PROD],
Expand Down