diff --git a/packages/next/server/next-server.ts b/packages/next/server/next-server.ts index 5930a26a6110f..805b0ae016417 100644 --- a/packages/next/server/next-server.ts +++ b/packages/next/server/next-server.ts @@ -128,6 +128,17 @@ export default class NextNodeServer extends BaseServer { }) ) } + + if (!this.renderOpts.dev) { + // pre-warm _document and _app as these will be + // needed for most requests + loadComponents(this.distDir, '/_document', this._isLikeServerless).catch( + () => {} + ) + loadComponents(this.distDir, '/_app', this._isLikeServerless).catch( + () => {} + ) + } } private compression =