mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
fix(vite): add back invalidateModule
call
this reverts commit b765251ce8
This commit is contained in:
parent
1ea4fafe1a
commit
5ab0e73d8a
@ -212,12 +212,13 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
|
||||
|
||||
nuxt.hook('vite:serverCreated', (server: vite.ViteDevServer, env) => {
|
||||
// Invalidate virtual modules when templates are re-generated
|
||||
ctx.nuxt.hook('app:templatesGenerated', (_app, changedTemplates) => {
|
||||
for (const template of changedTemplates) {
|
||||
ctx.nuxt.hook('app:templatesGenerated', async (_app, changedTemplates) => {
|
||||
await Promise.all(changedTemplates.map(async (template) => {
|
||||
for (const mod of server.moduleGraph.getModulesByFile(`virtual:nuxt:${encodeURIComponent(template.dst)}`) || []) {
|
||||
server.reloadModule(mod)
|
||||
}
|
||||
server.moduleGraph.invalidateModule(mod)
|
||||
await server.reloadModule(mod)
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
if (nuxt.options.vite.warmupEntry !== false) {
|
||||
|
Loading…
Reference in New Issue
Block a user