From 4185ec896fd70fa1831d7b88d39a646bab4f075a Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 5 Nov 2020 21:42:40 +0100 Subject: [PATCH] fix: extend routes from serverless.static --- packages/nitro/src/config.ts | 4 ---- packages/nitro/src/index.ts | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/nitro/src/config.ts b/packages/nitro/src/config.ts index dd7143eb5b..a3163547be 100644 --- a/packages/nitro/src/config.ts +++ b/packages/nitro/src/config.ts @@ -52,10 +52,6 @@ export function getoptions (nuxtOptions: NuxtOptions): SLSOptions { inlineChunks: true } - if (Array.isArray(nuxtOptions.generate.routes)) { - defaults.static = nuxtOptions.generate.routes - } - let target = process.env.NUXT_SLS_TARGET || nuxtOptions.serverless.target || 'node' if (typeof target === 'function') { target = target(nuxtOptions) diff --git a/packages/nitro/src/index.ts b/packages/nitro/src/index.ts index 108cf714e5..eb2a531e86 100644 --- a/packages/nitro/src/index.ts +++ b/packages/nitro/src/index.ts @@ -19,6 +19,12 @@ export default function slsModule () { nuxt.options.build.standalone = true nuxt.options.generate.crawler = false + if (Array.isArray(nuxt.options.generate.routes)) { + nuxt.options.generate.routes = Array.from(new Set([ + ...nuxt.options.generate.routes, + ...options.static + ])) + } nuxt.hook('generate:cache:ignore', (ignore) => { ignore.push(options.slsDir)