Skip to content

Commit

Permalink
Error on mismatched minimal react version (#65806)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
huozhi committed May 17, 2024
1 parent 2ae4a47 commit 046acd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/yarn-pnp/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 046acd5

Please sign in to comment.