Skip to content

Commit

Permalink
Revert "Revert react-server-dom require change" (#55382)
Browse files Browse the repository at this point in the history
Reverts #55345

Closes WEB-1561

---------

Co-authored-by: Tobias Koppers <[email protected]>
  • Loading branch information
ForsakenHarmony and sokra authored Sep 14, 2023
1 parent 129f56d commit 724ece8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down
8 changes: 5 additions & 3 deletions packages/next/src/server/app-render/use-flight-response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 724ece8

Please sign in to comment.