Skip to content

Commit 9050394

Browse files
committed
Don't default reactRoot for 10.x
1 parent 7aaf85b commit 9050394

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

.github/workflows/test_react_experimental.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
NEXT_TELEMETRY_DISABLED: 1
3232
HEADLESS: true
3333
NEXT_PRIVATE_SKIP_SIZE_TESTS: true
34+
NEXT_PRIVATE_REACT_ROOT: 1
3435
strategy:
3536
fail-fast: false
3637
matrix:

packages/next/next-server/server/config-shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const defaultConfig: NextConfig = {
115115
externalDir: false,
116116
serialWebpackBuild: false,
117117
turboMode: false,
118-
reactRoot: false,
118+
reactRoot: Number(process.env.NEXT_PRIVATE_REACT_ROOT) > 0,
119119
},
120120
future: {
121121
strictPostcssConfiguration: false,

packages/next/next-server/server/config.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { defaultConfig, normalizeConfig } from './config-shared'
99
import { loadWebpackHook } from './config-utils'
1010
import { ImageConfig, imageConfigDefault, VALID_LOADERS } from './image-config'
1111
import { loadEnvConfig } from '@next/env'
12-
import ReactDOM from 'react'
1312

1413
export { DomainLocales, NextConfig, normalizeConfig } from './config-shared'
1514

@@ -387,18 +386,6 @@ function assignDefaults(userConfig: { [key: string]: any }) {
387386
}
388387
}
389388

390-
if (
391-
typeof userConfig.experimental?.reactRoot === 'undefined' &&
392-
(typeof (ReactDOM as any).createRoot === 'function' ||
393-
typeof (ReactDOM as any).unstable_createRoot === 'function')
394-
) {
395-
console.warn(
396-
chalk.yellow.bold('Warning: ') +
397-
'The "reactRoot" option defaulted to "true" based on your version of React. Please update your next.config.js.'
398-
)
399-
result.experimental.reactRoot = true
400-
}
401-
402389
return result
403390
}
404391

0 commit comments

Comments
 (0)