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,15 @@ export type CloudflareOverrides = {
4546 * @default false
4647 */
4748 enableCacheInterception ?: boolean ;
49+
50+ /**
51+ * Set the route preloading behavior.
52+ *
53+ * Using a value other than "none" can result in higher CPU usage on cold starts.
54+ *
55+ * @default "none"
56+ */
57+ routePreloadingBehavior ?: RoutePreloadingBehavior ;
4858} ;
4959
5060/**
@@ -54,7 +64,14 @@ export type CloudflareOverrides = {
5464 * @returns the OpenNext configuration object
5565 */
5666export function defineCloudflareConfig ( config : CloudflareOverrides = { } ) : OpenNextConfig {
57- const { incrementalCache, tagCache, queue, cachePurge, enableCacheInterception = false } = config ;
67+ const {
68+ incrementalCache,
69+ tagCache,
70+ queue,
71+ cachePurge,
72+ enableCacheInterception = false ,
73+ routePreloadingBehavior = "none" ,
74+ } = config ;
5875
5976 return {
6077 default : {
@@ -67,7 +84,7 @@ export function defineCloudflareConfig(config: CloudflareOverrides = {}): OpenNe
6784 queue : resolveQueue ( queue ) ,
6885 cdnInvalidation : resolveCdnInvalidation ( cachePurge ) ,
6986 } ,
70- routePreloadingBehavior : "withWaitUntil" ,
87+ routePreloadingBehavior,
7188 } ,
7289 // node:crypto is used to compute cache keys
7390 edgeExternals : [ "node:crypto" ] ,
0 commit comments