Error on mismatched minimal react version (#65806)

### What
Error when users installing react@18 and requires higher version

### Why

The architecture now already requires to have `react@beta` or
`react@rc`. Especially where we need to load `react-server` condition of
react, which is erroring now in react 18.
This commit is contained in:
Jiachi Liu 2024-05-17 10:08:28 +02:00 committed by GitHub
parent 2ae4a4786a
commit 046acd504e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -105,8 +105,8 @@ const NEXT_PROJECT_ROOT_DIST_CLIENT = path.join(
'client'
)
if (parseInt(React.version) < 18) {
throw new Error('Next.js requires react >= 18.2.0 to be installed.')
if (parseInt(React.version) < 19) {
throw new Error('Next.js requires react >= 19.0.0 to be installed.')
}
export const babelIncludeRegexes: RegExp[] = [

View file

@ -43,6 +43,8 @@ export function runTests(
dependencies: {
...packageJson.dependencies,
...packageJson.devDependencies,
react: '19.0.0-beta-04b058868c-20240508',
'react-dom': '19.0.0-beta-04b058868c-20240508',
},
installCommand: ({ dependencies }) => {
const pkgs = Object.keys(dependencies).reduce((prev, cur) => {