33 BaseOverride ,
44 LazyLoadedOverride ,
55 OpenNextConfig as AwsOpenNextConfig ,
6+ type RoutePreloadingBehavior ,
67} from "@opennextjs/aws/types/open-next" ;
78import type {
89 CDNInvalidationHandler ,
@@ -45,6 +46,13 @@ export type CloudflareOverrides = {
4546 * @default false
4647 */
4748 enableCacheInterception ?: boolean ;
49+
50+ /**
51+ * Route preloading behavior.
52+ * Using a value other than "none" can result in higher CPU usage on cold starts.
53+ * @default "none"
54+ */
55+ routePreloadingBehavior ?: RoutePreloadingBehavior ;
4856} ;
4957
5058/**
@@ -54,7 +62,14 @@ export type CloudflareOverrides = {
5462 * @returns the OpenNext configuration object
5563 */
5664export function defineCloudflareConfig ( config : CloudflareOverrides = { } ) : OpenNextConfig {
57- const { incrementalCache, tagCache, queue, cachePurge, enableCacheInterception = false } = config ;
65+ const {
66+ incrementalCache,
67+ tagCache,
68+ queue,
69+ cachePurge,
70+ enableCacheInterception = false ,
71+ routePreloadingBehavior = "none" ,
72+ } = config ;
5873
5974 return {
6075 default : {
@@ -67,7 +82,7 @@ export function defineCloudflareConfig(config: CloudflareOverrides = {}): OpenNe
6782 queue : resolveQueue ( queue ) ,
6883 cdnInvalidation : resolveCdnInvalidation ( cachePurge ) ,
6984 } ,
70- routePreloadingBehavior : "withWaitUntil" ,
85+ routePreloadingBehavior,
7186 } ,
7287 // node:crypto is used to compute cache keys
7388 edgeExternals : [ "node:crypto" ] ,
0 commit comments