Unverified Commit 64f38c4b authored by OJ Kwon's avatar OJ Kwon Committed by GitHub

fix(next): add alias to new react exports (#65761)

### What

There is a new react exports entrypoints in pkg.json, which we didn't
add alias as similar to other export conditions.
parent 2fb5ad79
...@@ -664,6 +664,7 @@ async fn rsc_aliases( ...@@ -664,6 +664,7 @@ async fn rsc_aliases(
"react-dom" => format!("next/dist/compiled/react-dom{react_channel}"), "react-dom" => format!("next/dist/compiled/react-dom{react_channel}"),
"react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime"), "react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime"),
"react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime"), "react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime"),
"react/compiler-runtime" => format!("next/dist/compiled/react{react_channel}/compiler-runtime"),
"react-dom/client" => format!("next/dist/compiled/react-dom{react_channel}/client"), "react-dom/client" => format!("next/dist/compiled/react-dom{react_channel}/client"),
"react-dom/static" => format!("next/dist/compiled/react-dom-experimental/static"), "react-dom/static" => format!("next/dist/compiled/react-dom-experimental/static"),
"react-dom/static.edge" => format!("next/dist/compiled/react-dom-experimental/static.edge"), "react-dom/static.edge" => format!("next/dist/compiled/react-dom-experimental/static.edge"),
...@@ -687,6 +688,7 @@ async fn rsc_aliases( ...@@ -687,6 +688,7 @@ async fn rsc_aliases(
alias.extend(indexmap! { alias.extend(indexmap! {
"react/jsx-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-jsx-runtime"), "react/jsx-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-jsx-runtime"),
"react/jsx-dev-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-jsx-dev-runtime"), "react/jsx-dev-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-jsx-dev-runtime"),
"react/compiler-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-compiler-runtime"),
"react" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react"), "react" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react"),
"react-dom" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-dom"), "react-dom" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-dom"),
"react-server-dom-webpack/client.edge" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-server-dom-turbopack-client-edge"), "react-server-dom-webpack/client.edge" => format!("next/dist/server/future/route-modules/app-page/vendored/ssr/react-server-dom-turbopack-client-edge"),
...@@ -697,6 +699,7 @@ async fn rsc_aliases( ...@@ -697,6 +699,7 @@ async fn rsc_aliases(
alias.extend(indexmap! { alias.extend(indexmap! {
"react/jsx-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-jsx-runtime"), "react/jsx-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-jsx-runtime"),
"react/jsx-dev-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime"), "react/jsx-dev-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime"),
"react/compiler-runtime" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-compiler-runtime"),
"react" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react"), "react" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react"),
"react-dom" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-dom"), "react-dom" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-dom"),
"react-server-dom-webpack/server.edge" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-edge"), "react-server-dom-webpack/server.edge" => format!("next/dist/server/future/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-edge"),
...@@ -719,8 +722,10 @@ async fn rsc_aliases( ...@@ -719,8 +722,10 @@ async fn rsc_aliases(
"next/dist/compiled/react" => format!("next/dist/compiled/react{react_channel}/react.react-server"), "next/dist/compiled/react" => format!("next/dist/compiled/react{react_channel}/react.react-server"),
"next/dist/compiled/react-experimental" => format!("next/dist/compiled/react-experimental/react.react-server"), "next/dist/compiled/react-experimental" => format!("next/dist/compiled/react-experimental/react.react-server"),
"react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime.react-server"), "react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime.react-server"),
"react/compiler-runtime" => format!("next/dist/compiled/react{react_channel}/compiler-runtime"),
"next/dist/compiled/react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime.react-server"), "next/dist/compiled/react/jsx-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-runtime.react-server"),
"next/dist/compiled/react-experimental/jsx-runtime" => format!("next/dist/compiled/react-experimental/jsx-runtime.react-server"), "next/dist/compiled/react-experimental/jsx-runtime" => format!("next/dist/compiled/react-experimental/jsx-runtime.react-server"),
"next/dist/compiled/react/compiler-runtime" => format!("next/dist/compiled/react{react_channel}/compiler-runtime"),
"react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime.react-server"), "react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime.react-server"),
"next/dist/compiled/react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime.react-server"), "next/dist/compiled/react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime.react-server"),
"next/dist/compiled/react-experimental/jsx-dev-runtime" => format!("next/dist/compiled/react-experimental/jsx-dev-runtime.react-server"), "next/dist/compiled/react-experimental/jsx-dev-runtime" => format!("next/dist/compiled/react-experimental/jsx-dev-runtime.react-server"),
......
...@@ -252,6 +252,7 @@ export function createRSCAliases( ...@@ -252,6 +252,7 @@ export function createRSCAliases(
'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`, 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`,
'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime`, 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime`,
'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime`, 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime`,
'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,
'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`, 'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`,
'react-dom/server$': `next/dist/compiled/react-dom${bundledReactChannel}/server`, 'react-dom/server$': `next/dist/compiled/react-dom${bundledReactChannel}/server`,
'react-dom/static$': `next/dist/compiled/react-dom-experimental/static`, 'react-dom/static$': `next/dist/compiled/react-dom-experimental/static`,
...@@ -272,6 +273,7 @@ export function createRSCAliases( ...@@ -272,6 +273,7 @@ export function createRSCAliases(
alias = Object.assign(alias, { alias = Object.assign(alias, {
'react/jsx-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-runtime`, 'react/jsx-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,
'react/jsx-dev-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`, 'react/jsx-dev-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,
'react/compiler-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,
react$: `next/dist/server/future/route-modules/app-page/vendored/${layer}/react`, react$: `next/dist/server/future/route-modules/app-page/vendored/${layer}/react`,
'react-dom$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-dom`, 'react-dom$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-dom`,
'react-server-dom-webpack/client.edge$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-client-edge`, 'react-server-dom-webpack/client.edge$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-client-edge`,
...@@ -280,6 +282,7 @@ export function createRSCAliases( ...@@ -280,6 +282,7 @@ export function createRSCAliases(
alias = Object.assign(alias, { alias = Object.assign(alias, {
'react/jsx-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-runtime`, 'react/jsx-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,
'react/jsx-dev-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`, 'react/jsx-dev-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,
'react/compiler-runtime$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,
react$: `next/dist/server/future/route-modules/app-page/vendored/${layer}/react`, react$: `next/dist/server/future/route-modules/app-page/vendored/${layer}/react`,
'react-dom$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-dom`, 'react-dom$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-dom`,
'react-server-dom-webpack/server.edge$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-edge`, 'react-server-dom-webpack/server.edge$': `next/dist/server/future/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-edge`,
...@@ -295,6 +298,7 @@ export function createRSCAliases( ...@@ -295,6 +298,7 @@ export function createRSCAliases(
'next/dist/compiled/react$': `next/dist/compiled/react${bundledReactChannel}/react.react-server`, 'next/dist/compiled/react$': `next/dist/compiled/react${bundledReactChannel}/react.react-server`,
'next/dist/compiled/react-experimental$': `next/dist/compiled/react-experimental/react.react-server`, 'next/dist/compiled/react-experimental$': `next/dist/compiled/react-experimental/react.react-server`,
'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`, 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,
'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,
'next/dist/compiled/react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`, 'next/dist/compiled/react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,
'next/dist/compiled/react-experimental/jsx-runtime$': `next/dist/compiled/react-experimental/jsx-runtime.react-server`, 'next/dist/compiled/react-experimental/jsx-runtime$': `next/dist/compiled/react-experimental/jsx-runtime.react-server`,
'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`, 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,
......
...@@ -2,6 +2,8 @@ import * as React from 'react' ...@@ -2,6 +2,8 @@ import * as React from 'react'
import * as ReactDOM from 'react-dom' import * as ReactDOM from 'react-dom'
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime' import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime'
import * as ReactJsxRuntime from 'react/jsx-runtime' import * as ReactJsxRuntime from 'react/jsx-runtime'
//@ts-expect-error TODO: current @types/react does not have exported types for this import
import * as ReactCompilerRuntime from 'react/compiler-runtime'
import '../../../../../next-fetch' import '../../../../../next-fetch'
function getAltProxyForBindingsDEV( function getAltProxyForBindingsDEV(
...@@ -80,6 +82,7 @@ export { ...@@ -80,6 +82,7 @@ export {
React, React,
ReactJsxDevRuntime, ReactJsxDevRuntime,
ReactJsxRuntime, ReactJsxRuntime,
ReactCompilerRuntime,
ReactDOM, ReactDOM,
ReactServerDOMWebpackServerEdge, ReactServerDOMWebpackServerEdge,
ReactServerDOMTurbopackServerEdge, ReactServerDOMTurbopackServerEdge,
......
module.exports = require('../../module.compiled').vendored[
'react-rsc'
].ReactCompilerRuntime
...@@ -2,6 +2,8 @@ import * as React from 'react' ...@@ -2,6 +2,8 @@ import * as React from 'react'
import * as ReactDOM from 'react-dom' import * as ReactDOM from 'react-dom'
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime' import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime'
import * as ReactJsxRuntime from 'react/jsx-runtime' import * as ReactJsxRuntime from 'react/jsx-runtime'
//@ts-expect-error TODO: current @types/react does not have exported types for this import
import * as ReactCompilerRuntime from 'react/compiler-runtime'
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import * as ReactDOMServerEdge from 'react-dom/server.edge' import * as ReactDOMServerEdge from 'react-dom/server.edge'
...@@ -54,6 +56,7 @@ export { ...@@ -54,6 +56,7 @@ export {
React, React,
ReactJsxDevRuntime, ReactJsxDevRuntime,
ReactJsxRuntime, ReactJsxRuntime,
ReactCompilerRuntime,
ReactDOM, ReactDOM,
ReactDOMServerEdge, ReactDOMServerEdge,
ReactServerDOMTurbopackClientEdge, ReactServerDOMTurbopackClientEdge,
......
module.exports = require('../../module.compiled').vendored[
'react-ssr'
].ReactCompilerRuntime
...@@ -8,6 +8,7 @@ const pagesExternals = [ ...@@ -8,6 +8,7 @@ const pagesExternals = [
'react/package.json', 'react/package.json',
'react/jsx-runtime', 'react/jsx-runtime',
'react/jsx-dev-runtime', 'react/jsx-dev-runtime',
'react/compiler-runtime',
'react-dom', 'react-dom',
'react-dom/package.json', 'react-dom/package.json',
'react-dom/client', 'react-dom/client',
...@@ -36,6 +37,7 @@ function makeAppAliases(reactChannel = '') { ...@@ -36,6 +37,7 @@ function makeAppAliases(reactChannel = '') {
'react-dom$': `next/dist/compiled/react-dom${reactChannel}`, 'react-dom$': `next/dist/compiled/react-dom${reactChannel}`,
'react/jsx-runtime$': `next/dist/compiled/react${reactChannel}/jsx-runtime`, 'react/jsx-runtime$': `next/dist/compiled/react${reactChannel}/jsx-runtime`,
'react/jsx-dev-runtime$': `next/dist/compiled/react${reactChannel}/jsx-dev-runtime`, 'react/jsx-dev-runtime$': `next/dist/compiled/react${reactChannel}/jsx-dev-runtime`,
'react/compiler-runtime$': `next/dist/compiled/react${reactChannel}/compiler-runtime`,
'react-dom/client$': `next/dist/compiled/react-dom${reactChannel}/client`, 'react-dom/client$': `next/dist/compiled/react-dom${reactChannel}/client`,
'react-dom/server$': `next/dist/compiled/react-dom${reactChannel}/server`, 'react-dom/server$': `next/dist/compiled/react-dom${reactChannel}/server`,
'react-dom/static$': `next/dist/compiled/react-dom-experimental/static`, 'react-dom/static$': `next/dist/compiled/react-dom-experimental/static`,
...@@ -241,6 +243,8 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => { ...@@ -241,6 +243,8 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => {
[`next/dist/compiled/react${bundledReactChannel}/jsx-runtime$`]: `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`, [`next/dist/compiled/react${bundledReactChannel}/jsx-runtime$`]: `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,
'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`, 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,
[`next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime$`]: `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`, [`next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime$`]: `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,
'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,
[`next/dist/compiled/react${bundledReactChannel}/compiler-runtime$`]: `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,
'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`, 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,
[`next/dist/compiled/react-dom${bundledReactChannel}$`]: `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`, [`next/dist/compiled/react-dom${bundledReactChannel}$`]: `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment