@@ -153,6 +153,10 @@ export class FullBundleDevEnvironment extends DevEnvironment {
153
153
async triggerBundleRegenerationIfStale ( ) : Promise < boolean > {
154
154
const scheduled = await this . devEngine . scheduleBuildIfStale ( )
155
155
if ( scheduled ) {
156
+ this . devEngine . ensureCurrentBuildFinish ( ) . then ( ( ) => {
157
+ this . hot . send ( { type : 'full-reload' , path : '*' } )
158
+ this . logger . info ( colors . green ( `page reload` ) , { timestamp : true } )
159
+ } )
156
160
debug ?.( `TRIGGER: access to stale bundle, triggered bundle re-generation` )
157
161
}
158
162
return scheduled
@@ -173,6 +177,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
173
177
const rolldownOptions = resolveRolldownOptions ( this , chunkMetadataMap )
174
178
rolldownOptions . experimental ??= { }
175
179
rolldownOptions . experimental . hmr = {
180
+ new : true ,
176
181
implement : await getHmrImplementation ( this . getTopLevelConfig ( ) ) ,
177
182
}
178
183
@@ -181,7 +186,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
181
186
{
182
187
name : 'vite:full-bundle-mode:save-output' ,
183
188
generateBundle : ( _ , bundle ) => {
184
- this . memoryFiles . clear ( )
189
+ // NOTE: don't clear memoryFiles here as incremental build re-uses the files
185
190
for ( const outputFile of Object . values ( bundle ) ) {
186
191
this . memoryFiles . set ( outputFile . fileName , ( ) =>
187
192
outputFile . type === 'chunk' ? outputFile . code : outputFile . source ,
@@ -228,6 +233,10 @@ export class FullBundleDevEnvironment extends DevEnvironment {
228
233
colors . green ( `trigger page reload ` ) + colors . dim ( shortFile ) + reason ,
229
234
{ clear : ! firstInvalidatedBy , timestamp : true } ,
230
235
)
236
+ this . devEngine . ensureLatestBuild ( ) . then ( ( ) => {
237
+ this . hot . send ( { type : 'full-reload' , path : '*' } )
238
+ this . logger . info ( colors . green ( `page reload` ) , { timestamp : true } )
239
+ } )
231
240
return
232
241
}
233
242
0 commit comments