Unverified Commit 0899283a authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[next-dev] Set `TURBOPACK` env before loading config (#82162)

### Why?

In `next dev`, `process.env.TURBOPACK` was set after `loadConfig`, which
caused the `process.env.TURBOPACK` conditions within the initial
`loadConfig` calls to be skipped unexpectedly.
parent d0b0cf0f
......@@ -161,6 +161,15 @@ const nextDev = async (
portSource: PortSource,
directory?: string
) => {
const isTurbopack = Boolean(
options.turbo || options.turbopack || process.env.IS_TURBOPACK_TEST
)
if (isTurbopack) {
process.env.TURBOPACK = '1'
}
isTurboSession = isTurbopack
dir = getProjectDir(process.env.NEXT_PRIVATE_DEV_DIR || directory)
// Check if pages dir exists and warn if not
......@@ -238,15 +247,6 @@ const nextDev = async (
hostname: host,
}
const isTurbopack = Boolean(
options.turbo || options.turbopack || process.env.IS_TURBOPACK_TEST
)
if (isTurbopack) {
process.env.TURBOPACK = '1'
}
isTurboSession = isTurbopack
const distDir = path.join(dir, config.distDir ?? '.next')
setGlobal('phase', PHASE_DEVELOPMENT_SERVER)
setGlobal('distDir', distDir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment