diff --git a/example/nuxt.config.js b/example/nuxt.config.js index 15c7bc2b..5e88b8a6 100644 --- a/example/nuxt.config.js +++ b/example/nuxt.config.js @@ -6,6 +6,7 @@ const isTest = process.env.NODE_ENV === 'test' const DEFAULT_LANG = 'en' module.exports = { + target: 'static', dev: isDev, diff --git a/lib/module.js b/lib/module.js index 4cba9b79..4fd01f0a 100644 --- a/lib/module.js +++ b/lib/module.js @@ -147,6 +147,11 @@ module.exports = function (moduleOptions) { async function moduleSetup (moduleScope, options) { options.pageExtend = options.pageExtend || DEFAULT_PAGE_EXTEND + // // ignore last server generate + if (moduleScope.nuxt.options.target === 'static' && moduleScope.nuxt.server && !moduleScope.nuxt.options.dev) { + return + } + registerHooks(moduleScope.nuxt) const layout = await cacheLayout(moduleScope, options) diff --git a/test/module.test.js b/test/module.test.js index 4e0d1d6f..46fd255e 100644 --- a/test/module.test.js +++ b/test/module.test.js @@ -4,7 +4,11 @@ describe('module', () => { let nuxt beforeAll(async () => { - ({ nuxt } = (await generate(loadConfig(__dirname, '../../example')))) + const overrides = { + target: null + }; + + ({ nuxt } = (await generate(loadConfig(__dirname, '../../example', overrides, { merge: true })))) await nuxt.listen(await generatePort(60000)) }, 80000)