@@ -13,7 +13,6 @@ import { loadEnvConfig } from '@next/env'
13
13
export { DomainLocales , NextConfig , normalizeConfig } from './config-shared'
14
14
15
15
const targets = [ 'server' , 'serverless' , 'experimental-serverless-trace' ]
16
- const reactModes = [ 'legacy' , 'blocking' , 'concurrent' ]
17
16
18
17
const experimentalWarning = execOnce ( ( ) => {
19
18
Log . warn ( chalk . bold ( 'You have enabled experimental feature(s).' ) )
@@ -36,6 +35,19 @@ function assignDefaults(userConfig: { [key: string]: any }) {
36
35
delete userConfig . exportTrailingSlash
37
36
}
38
37
38
+ if ( typeof userConfig . experimental ?. reactMode !== 'undefined' ) {
39
+ console . warn (
40
+ chalk . yellow . bold ( 'Warning: ' ) +
41
+ 'The experimental "reactMode" option has been replaced with "reactRoot". Please update your next.config.js.'
42
+ )
43
+ if ( typeof userConfig . experimental ?. reactRoot === 'undefined' ) {
44
+ userConfig . experimental . reactRoot = [ 'concurrent' , 'blocking' ] . includes (
45
+ userConfig . experimental . reactMode
46
+ )
47
+ }
48
+ delete userConfig . experimental . reactMode
49
+ }
50
+
39
51
const config = Object . keys ( userConfig ) . reduce < { [ key : string ] : any } > (
40
52
( currentConfig , key ) => {
41
53
const value = userConfig [ key ]
@@ -435,17 +447,6 @@ export default async function loadConfig(
435
447
: canonicalBase ) || ''
436
448
}
437
449
438
- if (
439
- userConfig . experimental ?. reactMode &&
440
- ! reactModes . includes ( userConfig . experimental . reactMode )
441
- ) {
442
- throw new Error (
443
- `Specified React Mode is invalid. Provided: ${
444
- userConfig . experimental . reactMode
445
- } should be one of ${ reactModes . join ( ', ' ) } `
446
- )
447
- }
448
-
449
450
if ( hasNextSupport ) {
450
451
userConfig . target = process . env . NEXT_PRIVATE_TARGET || 'server'
451
452
}
0 commit comments