File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -3709,6 +3709,10 @@ export default async function build(
3709
3709
// Ensure we wait for lockfile patching if present
3710
3710
await lockfilePatchPromise . cur
3711
3711
3712
+ if ( isTurbopack ) {
3713
+ warnAboutTurbopackBuilds ( loadedConfig )
3714
+ }
3715
+
3712
3716
// Ensure all traces are flushed before finishing the command
3713
3717
await flushAllTraces ( )
3714
3718
teardownTraceSubscriber ( )
@@ -3725,3 +3729,25 @@ export default async function build(
3725
3729
}
3726
3730
}
3727
3731
}
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
+ }
Original file line number Diff line number Diff line change @@ -19,19 +19,12 @@ import loadConfig from '../../server/config'
19
19
import { hasCustomExportOutput } from '../../export/utils'
20
20
import { Telemetry } from '../../telemetry/storage'
21
21
import { setGlobal } from '../../trace'
22
- import { isStableBuild , CanaryOnlyError } from '../../shared/lib/canary-only'
23
22
24
23
export async function turbopackBuild ( ) : Promise < {
25
24
duration : number
26
25
buildTraceContext : undefined
27
26
shutdownPromise : Promise < void >
28
27
} > {
29
- if ( isStableBuild ( ) ) {
30
- throw new CanaryOnlyError (
31
- 'Turbopack builds are only available in canary builds of Next.js.'
32
- )
33
- }
34
-
35
28
await validateTurboNextConfig ( {
36
29
dir : NextBuildContext . dir ! ,
37
30
isDev : false ,
You can’t perform that action at this time.
0 commit comments