diff --git a/packages/vite/src/vite-node.ts b/packages/vite/src/vite-node.ts index b10a59e884..5b3e1f2a8f 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!)) + } } }