diff --git a/packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts b/packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts index 341334e3d4d5d..e186b66087d20 100644 --- a/packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts +++ b/packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts @@ -54,6 +54,7 @@ export function getRender({ } const server = new WebServer({ + dev, conf: config, minimalMode: true, webServerConfig: { diff --git a/packages/next/server/load-components.ts b/packages/next/server/load-components.ts index 3b03250be45d5..7f44ccac93f1e 100644 --- a/packages/next/server/load-components.ts +++ b/packages/next/server/load-components.ts @@ -111,11 +111,19 @@ export async function loadComponents( } const [DocumentMod, AppMod, ComponentMod, AppServerMod] = await Promise.all([ - requirePage('/_document', distDir, serverless, rootEnabled), - requirePage('/_app', distDir, serverless, rootEnabled), - requirePage(pathname, distDir, serverless, rootEnabled), + Promise.resolve().then(() => + requirePage('/_document', distDir, serverless, rootEnabled) + ), + Promise.resolve().then(() => + requirePage('/_app', distDir, serverless, rootEnabled) + ), + Promise.resolve().then(() => + requirePage(pathname, distDir, serverless, rootEnabled) + ), serverComponents - ? requirePage('/_app.server', distDir, serverless, rootEnabled) + ? Promise.resolve().then(() => + requirePage('/_app.server', distDir, serverless, rootEnabled) + ) : null, ]) diff --git a/packages/next/server/next-server.ts b/packages/next/server/next-server.ts index 47764d6a06cbb..3ce99c042e62b 100644 --- a/packages/next/server/next-server.ts +++ b/packages/next/server/next-server.ts @@ -126,7 +126,7 @@ export default class NextNodeServer extends BaseServer { ) } - if (!this.renderOpts.dev) { + if (!options.dev) { // pre-warm _document and _app as these will be // needed for most requests loadComponents(this.distDir, '/_document', this._isLikeServerless).catch(