Skip to content

Commit 9bd71e4

Browse files
committed
fix(vite): add back invalidateModule call
this reverts commit b765251
1 parent 86aff85 commit 9bd71e4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/vite/src/vite.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,13 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
213213

214214
nuxt.hook('vite:serverCreated', (server: vite.ViteDevServer, env) => {
215215
// Invalidate virtual modules when templates are re-generated
216-
ctx.nuxt.hook('app:templatesGenerated', (_app, changedTemplates) => {
217-
for (const template of changedTemplates) {
216+
ctx.nuxt.hook('app:templatesGenerated', async (_app, changedTemplates) => {
217+
await Promise.all(changedTemplates.map(async (template) => {
218218
for (const mod of server.moduleGraph.getModulesByFile(`virtual:nuxt:${encodeURIComponent(template.dst)}`) || []) {
219-
server.reloadModule(mod)
219+
server.moduleGraph.invalidateModule(mod)
220+
await server.reloadModule(mod)
220221
}
221-
}
222+
}))
222223
})
223224

224225
if (nuxt.options.vite.warmupEntry !== false) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy