Skip to content

Commit ba1d974

Browse files
committed
fix: pass hmr self accept test
1 parent 4c95fe4 commit ba1d974

File tree

4 files changed

+868
-843
lines changed

4 files changed

+868
-843
lines changed

packages/vite/src/client/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ const hmrClient = new HMRClient(
183183
}
184184
return await importPromise
185185
},
186+
__FULL_BUNDLE_MODE__,
186187
)
187188
transport.connect!(createHMRHandler(handleMessage))
188189

packages/vite/src/node/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ async function buildEnvironment(
636636
// ? 'strict'
637637
// : false,
638638
// cache: options.watch ? undefined : false,
639+
cwd: root,
639640
...options.rollupOptions,
640641
output: options.rollupOptions.output,
641642
input,

packages/vite/src/shared/hmr.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export class HMRClient {
181181
private transport: NormalizedModuleRunnerTransport,
182182
// This allows implementing reloading via different methods depending on the environment
183183
private importUpdatedModule: (update: Update) => Promise<ModuleNamespace>,
184+
private fullBundleMode: boolean,
184185
) {}
185186

186187
public async notifyListeners<T extends string>(
@@ -296,7 +297,13 @@ export class HMRClient {
296297
),
297298
)
298299
}
299-
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`
300+
const loggedPath = this.fullBundleMode
301+
? isSelfUpdate
302+
? `/${path}`
303+
: `/${acceptedPath} via /${path}`
304+
: isSelfUpdate
305+
? path
306+
: `${acceptedPath} via ${path}`
300307
this.logger.debug(`hot updated: ${loggedPath}`)
301308
} finally {
302309
this.currentFirstInvalidatedBy = undefined

0 commit comments

Comments
 (0)