Skip to content

Commit

Permalink
Add support for async experimental.initServer() (#2798)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon Bayer <[email protected]> (minor)
  • Loading branch information
g3offrey authored Oct 20, 2021
1 parent 4d1c997 commit 8fc8800
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions nextjs/packages/next/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export default class Server {
assetPrefix,
generateEtags,
compress,
experimental,
} = this.nextConfig

this.buildId = this.readBuildId()
Expand Down Expand Up @@ -277,10 +276,6 @@ export default class Server {
this.router = new Router(this.generateRoutes())
this.setAssetPrefix(assetPrefix)

if (experimental.initServer) {
experimental.initServer()
}

this.incrementalCache = new IncrementalCache({
dev,
distDir: this.distDir,
Expand Down
5 changes: 5 additions & 0 deletions nextjs/packages/next/server/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export class NextServer {
if (!this.serverPromise) {
setTimeout(getServerImpl, 10)
this.serverPromise = this.loadConfig().then(async (conf) => {
const initServerCallback = conf.experimental.initServer
if (initServerCallback) {
await initServerCallback()
}

this.server = await this.createServer({
...this.options,
conf,
Expand Down

0 comments on commit 8fc8800

Please sign in to comment.