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)