Skip to content

Commit 79e30f9

Browse files
authored
More React 17 clean up (#26775)
Remove unnecessary `React.Suspense` checks, as the minimum supported version is `react@>=17.0.1`. Also removes some files from the `react-18` integration test that are no longer necessary as of #26664.
1 parent 3c984dc commit 79e30f9

File tree

3 files changed

+0
-33
lines changed

3 files changed

+0
-33
lines changed

packages/next/bin/next.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,6 @@ if (process.env.NODE_ENV && !standardEnv.includes(process.env.NODE_ENV)) {
9393

9494
;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
9595

96-
// this needs to come after we set the correct NODE_ENV or
97-
// else it might cause SSR to break
98-
const React = require('react')
99-
100-
if (typeof React.Suspense === 'undefined') {
101-
throw new Error(
102-
`The version of React you are using is lower than the minimum required version needed for Next.js. Please upgrade "react" and "react-dom": "npm install react react-dom" https://nextjs.org/docs/messages/invalid-react-version`
103-
)
104-
}
105-
10696
// Make sure commands gracefully respect termination signals (e.g. from Docker)
10797
process.on('SIGTERM', () => process.exit(0))
10898
process.on('SIGINT', () => process.exit(0))

packages/next/server/dev/next-dev-server.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ import {
4848
} from '../load-components'
4949
import { DecodeError } from '../../shared/lib/utils'
5050

51-
if (typeof React.Suspense === 'undefined') {
52-
throw new Error(
53-
`The version of React you are using is lower than the minimum required version needed for Next.js. Please upgrade "react" and "react-dom": "npm install react react-dom" https://nextjs.org/docs/messages/invalid-react-version`
54-
)
55-
}
56-
5751
// Load ReactDevOverlay only when needed
5852
let ReactDevOverlayImpl: React.FunctionComponent
5953
const ReactDevOverlay = (props: any) => {

test/unit/handles-incorrect-react.unit.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)