Skip to content

Commit

Permalink
Don't default reactRoot for 10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
devknoll committed Apr 22, 2021
1 parent 7aaf85b commit 9050394
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test_react_experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
NEXT_TELEMETRY_DISABLED: 1
HEADLESS: true
NEXT_PRIVATE_SKIP_SIZE_TESTS: true
NEXT_PRIVATE_REACT_ROOT: 1
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion packages/next/next-server/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const defaultConfig: NextConfig = {
externalDir: false,
serialWebpackBuild: false,
turboMode: false,
reactRoot: false,
reactRoot: Number(process.env.NEXT_PRIVATE_REACT_ROOT) > 0,
},
future: {
strictPostcssConfiguration: false,
Expand Down
13 changes: 0 additions & 13 deletions packages/next/next-server/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { defaultConfig, normalizeConfig } from './config-shared'
import { loadWebpackHook } from './config-utils'
import { ImageConfig, imageConfigDefault, VALID_LOADERS } from './image-config'
import { loadEnvConfig } from '@next/env'
import ReactDOM from 'react'

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

Expand Down Expand Up @@ -387,18 +386,6 @@ function assignDefaults(userConfig: { [key: string]: any }) {
}
}

if (
typeof userConfig.experimental?.reactRoot === 'undefined' &&
(typeof (ReactDOM as any).createRoot === 'function' ||
typeof (ReactDOM as any).unstable_createRoot === 'function')
) {
console.warn(
chalk.yellow.bold('Warning: ') +
'The "reactRoot" option defaulted to "true" based on your version of React. Please update your next.config.js.'
)
result.experimental.reactRoot = true
}

return result
}

Expand Down

0 comments on commit 9050394

Please sign in to comment.