Skip to content

Commit 9e5fe76

Browse files
committed
wip: update
1 parent 69aa061 commit 9e5fe76

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/vite/src/node/server/environments/fullBundleEnvironment.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ export class FullBundleDevEnvironment extends DevEnvironment {
153153
async triggerBundleRegenerationIfStale(): Promise<boolean> {
154154
const scheduled = await this.devEngine.scheduleBuildIfStale()
155155
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+
})
156160
debug?.(`TRIGGER: access to stale bundle, triggered bundle re-generation`)
157161
}
158162
return scheduled
@@ -173,6 +177,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
173177
const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap)
174178
rolldownOptions.experimental ??= {}
175179
rolldownOptions.experimental.hmr = {
180+
new: true,
176181
implement: await getHmrImplementation(this.getTopLevelConfig()),
177182
}
178183

@@ -181,7 +186,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
181186
{
182187
name: 'vite:full-bundle-mode:save-output',
183188
generateBundle: (_, bundle) => {
184-
this.memoryFiles.clear()
189+
// NOTE: don't clear memoryFiles here as incremental build re-uses the files
185190
for (const outputFile of Object.values(bundle)) {
186191
this.memoryFiles.set(outputFile.fileName, () =>
187192
outputFile.type === 'chunk' ? outputFile.code : outputFile.source,
@@ -228,6 +233,10 @@ export class FullBundleDevEnvironment extends DevEnvironment {
228233
colors.green(`trigger page reload `) + colors.dim(shortFile) + reason,
229234
{ clear: !firstInvalidatedBy, timestamp: true },
230235
)
236+
this.devEngine.ensureLatestBuild().then(() => {
237+
this.hot.send({ type: 'full-reload', path: '*' })
238+
this.logger.info(colors.green(`page reload`), { timestamp: true })
239+
})
231240
return
232241
}
233242

0 commit comments

Comments
 (0)