Skip to content

Commit

Permalink
Add flag to control app document preloading (#48115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Apr 8, 2023
1 parent 4e3f135 commit 1caa589
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/next/src/server/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ const configSchema = {
experimental: {
additionalProperties: false,
properties: {
appDocumentPreloading: {
type: 'boolean',
},
adjustFontFallbacks: {
type: 'boolean',
},
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export interface NextJsWebpackConfig {
}

export interface ExperimentalConfig {
appDocumentPreloading?: boolean
strictNextHead?: boolean
clientRouterFilter?: boolean
clientRouterFilterRedirects?: boolean
Expand Down Expand Up @@ -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: '',
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 1caa589

Please sign in to comment.