From 14a7d951396f036883f946e2b7d779afaca698fb Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 22 Jun 2023 11:00:50 +0100 Subject: [PATCH] fix(nuxt): use static nitro build if possible (#21655) --- packages/nuxt/src/core/nitro.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 98171b3f74..a40a9ed8c1 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -39,6 +39,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { } const nitroConfig: NitroConfig = defu(_nitroConfig, { + static: nuxt.options._generate, debug: nuxt.options.debug, rootDir: nuxt.options.rootDir, workspaceDir: nuxt.options.workspaceDir, @@ -347,11 +348,12 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { await copyPublicAssets(nitro) await nuxt.callHook('nitro:build:public-assets', nitro) await prerender(nitro) - if (!nuxt.options._generate) { - logger.restoreAll() - await build(nitro) - logger.wrapAll() - } else { + + logger.restoreAll() + await build(nitro) + logger.wrapAll() + + if (nuxt.options._generate) { const distDir = resolve(nuxt.options.rootDir, 'dist') if (!existsSync(distDir)) { await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => {})