Skip to content

Commit

Permalink
only assign env when using react 18
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Apr 28, 2022
1 parent d7ddc6a commit ea77b1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/next/bin/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ if (process.env.NODE_ENV) {

;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
;(process.env as any).NEXT_RUNTIME = 'nodejs'
;(process.env as any).__NEXT_REACT_ROOT = shouldUseReactRoot
if (shouldUseReactRoot) {
;(process.env as any).__NEXT_REACT_ROOT = 'true'
}

// x-ref: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505
if (process.versions.pnp === '3') {
Expand Down
6 changes: 3 additions & 3 deletions packages/next/server/node-web-streams-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ export function createFlushEffectStream(
})
}

export async function renderToInitialStream({
export function renderToInitialStream({
ReactDOMServer,
element,
}: {
ReactDOMServer: typeof import('react-dom/server')
ReactDOMServer: any
element: React.ReactElement
}): Promise<
ReadableStream<Uint8Array> & {
allReady?: Promise<void>
}
> {
return await (ReactDOMServer as any).renderToReadableStream(element)
return ReactDOMServer.renderToReadableStream(element)
}

export async function continueFromInitialStream({
Expand Down

0 comments on commit ea77b1d

Please sign in to comment.