diff --git a/packages/vite/src/vite-node.ts b/packages/vite/src/vite-node.ts index bb63c257b9..ad9ee435a2 100644 --- a/packages/vite/src/vite-node.ts +++ b/packages/vite/src/vite-node.ts @@ -45,11 +45,11 @@ export function viteNodePlugin (ctx: ViteBuildContext): VitePlugin { markInvalidate(mod) } } - for (const plugin of ctx.nuxt.options.plugins) { - markInvalidates(server.moduleGraph.getModulesByFile(typeof plugin === 'string' ? plugin : plugin.src)) - } - for (const template of ctx.nuxt.options.build.templates) { - markInvalidates(server.moduleGraph.getModulesByFile(template.dst!)) + + if (ctx.nuxt.apps.default) { + for (const template of ctx.nuxt.apps.default.templates) { + markInvalidates(server.moduleGraph.getModulesByFile(template.dst!)) + } } }