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 = { ...@@ -226,6 +226,9 @@ const configSchema = {
experimental: { experimental: {
additionalProperties: false, additionalProperties: false,
properties: { properties: {
appDocumentPreloading: {
type: 'boolean',
},
adjustFontFallbacks: { adjustFontFallbacks: {
type: 'boolean', type: 'boolean',
}, },
......
...@@ -114,6 +114,7 @@ export interface NextJsWebpackConfig { ...@@ -114,6 +114,7 @@ export interface NextJsWebpackConfig {
} }
export interface ExperimentalConfig { export interface ExperimentalConfig {
appDocumentPreloading?: boolean
strictNextHead?: boolean strictNextHead?: boolean
clientRouterFilter?: boolean clientRouterFilter?: boolean
clientRouterFilterRedirects?: boolean clientRouterFilterRedirects?: boolean
...@@ -655,6 +656,7 @@ export const defaultConfig: NextConfig = { ...@@ -655,6 +656,7 @@ export const defaultConfig: NextConfig = {
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined, output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined, modularizeImports: undefined,
experimental: { experimental: {
appDocumentPreloading: true,
clientRouterFilter: false, clientRouterFilter: false,
clientRouterFilterRedirects: false, clientRouterFilterRedirects: false,
fetchCacheKeyPrefix: '', fetchCacheKeyPrefix: '',
......
...@@ -234,7 +234,7 @@ export default class NextNodeServer extends BaseServer { ...@@ -234,7 +234,7 @@ export default class NextNodeServer extends BaseServer {
this.imageResponseCache = new ResponseCache(this.minimalMode) 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 // pre-warm _document and _app as these will be
// needed for most requests // needed for most requests
loadComponents({ 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