diff --git a/modules/swell/index.js b/modules/swell/index.js index b9e76a3..7f9dd86 100644 --- a/modules/swell/index.js +++ b/modules/swell/index.js @@ -71,7 +71,14 @@ export default async function (moduleOptions) { return extendPluginsFn ? extendPluginsFn(plugins) : plugins; }; - this.options.generate.routes = () => getRoutes(swell); + // add Swell routes to existing routes + const nuxtRoutes = this.options.generate.routes; + if (typeof nuxtRoutes === 'function') { + this.options.generate.routes = async () => (await nuxtRoutes()).concat(await getRoutes(swell)); + } + if (Array.isArray(nuxtRoutes)) { + this.options.generate.routes = async () => nuxtRoutes.concat(await getRoutes(swell)); + } this.nuxt.hook('generate:done', (context) => { const { locales } = context.options.i18n;