Skip to content

Commit c525f9f

Browse files
committed
Turbopack builds: Remove canary-gate and add experimental warning
This: - Removes the Turbopack build canary gate - Adds a warning that Turbopack build support is experimental. - Links to the discussion page for feedback Test Plan: Installed and used in an app. Verified the link is valid.
1 parent 777b826 commit c525f9f

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

packages/next/src/build/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,6 +3709,10 @@ export default async function build(
37093709
// Ensure we wait for lockfile patching if present
37103710
await lockfilePatchPromise.cur
37113711

3712+
if (isTurbopack) {
3713+
warnAboutTurbopackBuilds(loadedConfig)
3714+
}
3715+
37123716
// Ensure all traces are flushed before finishing the command
37133717
await flushAllTraces()
37143718
teardownTraceSubscriber()
@@ -3725,3 +3729,25 @@ export default async function build(
37253729
}
37263730
}
37273731
}
3732+
3733+
function warnAboutTurbopackBuilds(config?: NextConfigComplete) {
3734+
let warningStr =
3735+
`Support for Turbopack builds is experimental. ` +
3736+
bold(
3737+
`We don't recommend deploying mission-critical applications to production.`
3738+
)
3739+
warningStr +=
3740+
'\n\n- It is expected that your bundle size might be different from `next build` with webpack. This will be improved as we work towards stability.'
3741+
3742+
if (!config?.experimental.turbo?.unstablePersistentCaching) {
3743+
warningStr +=
3744+
'\n- This build is without disk caching; subsequent builds will become faster when disk caching becomes available.'
3745+
}
3746+
3747+
warningStr +=
3748+
'\n- When comparing output to webpack builds, make sure to first clear the Next.js cache by deleting the `.next` directory.'
3749+
warningStr +=
3750+
'\n\nProvide feedback for Turbopack builds at https://github.com/vercel/next.js/discussions/77721'
3751+
3752+
Log.warn(warningStr)
3753+
}

packages/next/src/build/turbopack-build/impl.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@ import loadConfig from '../../server/config'
1919
import { hasCustomExportOutput } from '../../export/utils'
2020
import { Telemetry } from '../../telemetry/storage'
2121
import { setGlobal } from '../../trace'
22-
import { isStableBuild, CanaryOnlyError } from '../../shared/lib/canary-only'
2322

2423
export async function turbopackBuild(): Promise<{
2524
duration: number
2625
buildTraceContext: undefined
2726
shutdownPromise: Promise<void>
2827
}> {
29-
if (isStableBuild()) {
30-
throw new CanaryOnlyError(
31-
'Turbopack builds are only available in canary builds of Next.js.'
32-
)
33-
}
34-
3528
await validateTurboNextConfig({
3629
dir: NextBuildContext.dir!,
3730
isDev: false,

0 commit comments

Comments
 (0)