Unverified Commit 2725a6b7 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] Enable turbopackFileSystemCacheForBuild by default in non-stable releases (#94616)

This is enabled by default in canary releases if we detect certain
environment variables

In the future as part of stabilization this should be handled in the
build-adaptors as a more generic solution
parent 17c6c6df
...@@ -15,6 +15,8 @@ import type { ExperimentalPPRConfig } from './lib/experimental/ppr' ...@@ -15,6 +15,8 @@ import type { ExperimentalPPRConfig } from './lib/experimental/ppr'
import { INFINITE_CACHE } from '../lib/constants' import { INFINITE_CACHE } from '../lib/constants'
import type { FallbackRouteParam } from '../build/static-paths/types' import type { FallbackRouteParam } from '../build/static-paths/types'
import type { MemoryEvictionMode } from '../build/swc/types' import type { MemoryEvictionMode } from '../build/swc/types'
import { isStableBuild } from '../shared/lib/errors/canary-only-config-error'
import { isCI } from './ci-info'
/** /**
* Resolved form of the prefetchInlining config after normalization in * Resolved form of the prefetchInlining config after normalization in
...@@ -796,7 +798,7 @@ export interface ExperimentalConfig { ...@@ -796,7 +798,7 @@ export interface ExperimentalConfig {
/** /**
* Enable filesystem cache for the turbopack build. * Enable filesystem cache for the turbopack build.
* *
* Defaults to `false`. * Defaults to `true` in canary/preview builds, `false` in production.
*/ */
turbopackFileSystemCacheForBuild?: boolean turbopackFileSystemCacheForBuild?: boolean
...@@ -2070,7 +2072,7 @@ export const defaultConfig = Object.freeze({ ...@@ -2070,7 +2072,7 @@ export const defaultConfig = Object.freeze({
hideLogsAfterAbort: false, hideLogsAfterAbort: false,
mcpServer: true, mcpServer: true,
turbopackFileSystemCacheForDev: true, turbopackFileSystemCacheForDev: true,
turbopackFileSystemCacheForBuild: false, turbopackFileSystemCacheForBuild: turbopackFileSystemCacheForBuildDefault(),
turbopackInferModuleSideEffects: true, turbopackInferModuleSideEffects: true,
turbopackPluginRuntimeStrategy: 'childProcesses', turbopackPluginRuntimeStrategy: 'childProcesses',
}, },
...@@ -2078,6 +2080,15 @@ export const defaultConfig = Object.freeze({ ...@@ -2078,6 +2080,15 @@ export const defaultConfig = Object.freeze({
bundlePagesRouterDependencies: false, bundlePagesRouterDependencies: false,
} satisfies NextConfig) } satisfies NextConfig)
function turbopackFileSystemCacheForBuildDefault() {
if (isStableBuild()) return false
if (isCI && process.env.NOW_BUILDER) {
// Assume caching is available on vercel
return true
}
return false
}
export async function normalizeConfig(phase: string, config: any) { export async function normalizeConfig(phase: string, config: any) {
if (typeof config === 'function') { if (typeof config === 'function') {
config = config(phase, { defaultConfig }) config = config(phase, { defaultConfig })
......
...@@ -36,6 +36,7 @@ async function readFilesNext( ...@@ -36,6 +36,7 @@ async function readFilesNext(
cwd: path.join(next.testDir, next.distDir), cwd: path.join(next.testDir, next.distDir),
nodir: true, nodir: true,
dot: true, dot: true,
ignore: 'cache/**',
})) as string[] })) as string[]
) )
.filter((f) => !IGNORE.test(f) && !IGNORE_CONTENT_NEXT_REGEX.test(f)) .filter((f) => !IGNORE.test(f) && !IGNORE_CONTENT_NEXT_REGEX.test(f))
......
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