Unverified Commit 1caa5896 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add flag to control app document preloading (#48115)

x-ref: [slack
thread](https://vercel.slack.com/archives/C02EU7CEVB7/p1680910556362999?thread_ts=1680906129.293849&cid=C02EU7CEVB7)
parent 4e3f135f
......@@ -226,6 +226,9 @@ const configSchema = {
experimental: {
additionalProperties: false,
properties: {
appDocumentPreloading: {
type: 'boolean',
},
adjustFontFallbacks: {
type: 'boolean',
},
......
......@@ -114,6 +114,7 @@ export interface NextJsWebpackConfig {
}
export interface ExperimentalConfig {
appDocumentPreloading?: boolean
strictNextHead?: boolean
clientRouterFilter?: boolean
clientRouterFilterRedirects?: boolean
......@@ -655,6 +656,7 @@ export const defaultConfig: NextConfig = {
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined,
experimental: {
appDocumentPreloading: true,
clientRouterFilter: false,
clientRouterFilterRedirects: false,
fetchCacheKeyPrefix: '',
......
......@@ -234,7 +234,7 @@ export default class NextNodeServer extends BaseServer {
this.imageResponseCache = new ResponseCache(this.minimalMode)
}
if (!options.dev) {
if (!options.dev && !this.nextConfig.experimental.appDocumentPreloading) {
// pre-warm _document and _app as these will be
// needed for most requests
loadComponents({
......
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