Skip to content

Commit

Permalink
call initServer from getServer
Browse files Browse the repository at this point in the history
  • Loading branch information
g3offrey committed Oct 17, 2021
1 parent aa560d2 commit 40c5503
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 40c5503

Please sign in to comment.