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) => {
213
213
214
214
nuxt . hook ( 'vite:serverCreated' , ( server : vite . ViteDevServer , env ) => {
215
215
// 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 ) => {
218
218
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 )
220
221
}
221
- }
222
+ } ) )
222
223
} )
223
224
224
225
if ( nuxt . options . vite . warmupEntry !== false ) {
You can’t perform that action at this time.
0 commit comments