Skip to content

Commit

Permalink
rename -> shouldUseReactRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 14, 2022
1 parent 28c3fca commit 90aa826
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/next/build/webpack-config.ts
Expand Up @@ -50,7 +50,7 @@ import type { Span } from '../trace'
import { getRawPageExtensions } from './utils'
import browserslist from 'next/dist/compiled/browserslist'
import loadJsConfig from './load-jsconfig'
import { enableReactRoot } from '../server/config'
import { shouldUseReactRoot } from '../server/config'

const watchOptions = Object.freeze({
aggregateTimeout: 5,
Expand Down Expand Up @@ -336,7 +336,7 @@ export default async function getBaseWebpackConfig(
rewrites.afterFiles.length > 0 ||
rewrites.fallback.length > 0
const hasReactRefresh: boolean = dev && !isServer
const hasReactRoot = enableReactRoot()
const hasReactRoot = shouldUseReactRoot()
const runtime = config.experimental.runtime

// Make sure reactRoot is enabled when react 18 is detected
Expand Down
4 changes: 2 additions & 2 deletions packages/next/server/config.ts
Expand Up @@ -654,7 +654,7 @@ export default async function loadConfig(
)
}

const hasReactRoot = enableReactRoot()
const hasReactRoot = shouldUseReactRoot()
if (hasReactRoot) {
userConfig.experimental.reactRoot = true
}
Expand Down Expand Up @@ -704,7 +704,7 @@ export default async function loadConfig(
return completeConfig
}

export function enableReactRoot() {
export function shouldUseReactRoot() {
const reactDomVersion = require('react-dom').version
const isReactExperimental = Boolean(
reactDomVersion && /0\.0\.0-experimental/.test(reactDomVersion)
Expand Down

0 comments on commit 90aa826

Please sign in to comment.