Unverified Commit 724ece85 authored by Leah's avatar Leah Committed by GitHub

Revert "Revert react-server-dom require change" (#55382)

Reverts vercel/next.js#55345

Closes WEB-1561

---------
Co-authored-by: 's avatarTobias Koppers <tobias.koppers@googlemail.com>
parent 129f56d3
......@@ -252,6 +252,7 @@ export function getDefineEnv({
'process.env.NEXT_RUNTIME': JSON.stringify(
isEdgeServer ? 'edge' : isNodeServer ? 'nodejs' : undefined
),
'process.env.NEXT_MINIMAL': JSON.stringify(''),
'process.env.__NEXT_ACTIONS_DEPLOYMENT_ID': JSON.stringify(
config.experimental.useDeploymentIdServerActions
),
......
......@@ -20,9 +20,11 @@ export function useFlightResponse(
if (flightResponseRef.current !== null) {
return flightResponseRef.current
}
const {
createFromReadableStream,
} = require(`react-server-dom-webpack/client.edge`)
// react-server-dom-webpack/client.edge must not be hoisted for require cache clearing to work correctly
const { createFromReadableStream } = process.env.NEXT_MINIMAL
? // @ts-ignore
__non_webpack_require__(`react-server-dom-webpack/client.edge`)
: require(`react-server-dom-webpack/client.edge`)
const [renderStream, forwardStream] = req.tee()
const res = createFromReadableStream(renderStream, {
......
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