File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments