Skip to content

Commit

Permalink
Add _document and _app pre-import (#23261)
Browse files Browse the repository at this point in the history
* Add _document and _app pre-import

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
gwer and ijjk committed Feb 10, 2022
1 parent abf9f75 commit 4634356
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/next/server/next-server.ts
Expand Up @@ -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 =
Expand Down

0 comments on commit 4634356

Please sign in to comment.