Unverified Commit 79e30f9c authored by Gerald Monaco's avatar Gerald Monaco Committed by GitHub

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.
parent 3c984dc5
......@@ -93,16 +93,6 @@ if (process.env.NODE_ENV && !standardEnv.includes(process.env.NODE_ENV)) {
;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
// this needs to come after we set the correct NODE_ENV or
// else it might cause SSR to break
const React = require('react')
if (typeof React.Suspense === 'undefined') {
throw new Error(
`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`
)
}
// Make sure commands gracefully respect termination signals (e.g. from Docker)
process.on('SIGTERM', () => process.exit(0))
process.on('SIGINT', () => process.exit(0))
......
......@@ -48,12 +48,6 @@ import {
} from '../load-components'
import { DecodeError } from '../../shared/lib/utils'
if (typeof React.Suspense === 'undefined') {
throw new Error(
`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`
)
}
// Load ReactDevOverlay only when needed
let ReactDevOverlayImpl: React.FunctionComponent
const ReactDevOverlay = (props: any) => {
......
/* eslint-env jest */
import path from 'path'
jest.mock('react', () => ({
Suspense: undefined,
}))
const nextDir = path.dirname(require.resolve('next/package'))
const nextBin = path.join(nextDir, 'dist/bin/next')
describe('Handles Incorrect React Version', () => {
it('should throw an error when building with next', async () => {
expect(() => require(nextBin)).toThrow(
/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:\/\//
)
})
})
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