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