From 83d27bd158f6b0d9f2b776a47dbac4c68dc653fa Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Fri, 15 Apr 2022 18:31:19 +0200 Subject: [PATCH] feat: enable hybrid rendering for `nuxi build` (#4373) --- packages/nuxt3/src/core/nitro.ts | 10 +++++----- playground/nuxt.config.ts | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nuxt3/src/core/nitro.ts b/packages/nuxt3/src/core/nitro.ts index 44abb7c0a38..0fc0da62a8e 100644 --- a/packages/nuxt3/src/core/nitro.ts +++ b/packages/nuxt3/src/core/nitro.ts @@ -50,8 +50,10 @@ export async function initNitro (nuxt: Nuxt) { .map(dir => ({ dir })) ], prerender: { - crawlLinks: nuxt.options.generate.crawler, - routes: nuxt.options.generate.routes + crawlLinks: nuxt.options._generate ? nuxt.options.generate.crawler : false, + routes: [] + .concat(nuxt.options.generate.routes) + .concat(nuxt.options.ssr === false ? ['/', '/200', '/404'] : []) }, externals: { inline: [ @@ -143,9 +145,7 @@ export async function initNitro (nuxt: Nuxt) { } else { await prepare(nitro) await copyPublicAssets(nitro) - if (nuxt.options._generate || nuxt.options.target === 'static') { - await prerender(nitro) - } + await prerender(nitro) await build(nitro) } }) diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index a3e4d68096a..9526047cd59 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -1,4 +1,5 @@ import { defineNuxtConfig } from 'nuxt3' export default defineNuxtConfig({ + ssr: false })