handleHmrOutput() — vite Function Reference
Architecture documentation for the handleHmrOutput() function in fullBundleEnvironment.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 2ccc36f4_103c_b60e_efaa_01ea14db6138["handleHmrOutput()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5["FullBundleDevEnvironment"] 2ccc36f4_103c_b60e_efaa_01ea14db6138 -->|defined in| 8fcd8920_61ef_93b8_499a_c18a48b852e5 848ddbbd_3d45_b055_e84a_874b4ca3fd45["listen()"] 848ddbbd_3d45_b055_e84a_874b4ca3fd45 -->|calls| 2ccc36f4_103c_b60e_efaa_01ea14db6138 55a72845_539c_1cc5_148b_2c87bf18e4db["invalidateModule()"] 55a72845_539c_1cc5_148b_2c87bf18e4db -->|calls| 2ccc36f4_103c_b60e_efaa_01ea14db6138 2ff971ab_04c3_0402_34fc_dc2f5f3103ec["getShortName()"] 2ccc36f4_103c_b60e_efaa_01ea14db6138 -->|calls| 2ff971ab_04c3_0402_34fc_dc2f5f3103ec 76e38b65_cb19_7bed_a56c_352d99366e3b["set()"] 2ccc36f4_103c_b60e_efaa_01ea14db6138 -->|calls| 76e38b65_cb19_7bed_a56c_352d99366e3b style 2ccc36f4_103c_b60e_efaa_01ea14db6138 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/server/environments/fullBundleEnvironment.ts lines 312–367
private handleHmrOutput(
client: NormalizedHotChannelClient,
files: string[],
hmrOutput: HmrOutput,
invalidateInformation?: { firstInvalidatedBy: string },
) {
if (hmrOutput.type === 'Noop') return
const shortFile = files
.map((file) => getShortName(file, this.config.root))
.join(', ')
if (hmrOutput.type === 'FullReload') {
const reason = hmrOutput.reason
? colors.dim(` (${hmrOutput.reason})`)
: ''
this.logger.info(
colors.green(`trigger page reload `) + colors.dim(shortFile) + reason,
{ clear: !invalidateInformation, timestamp: true },
)
this.devEngine.ensureLatestBuildOutput().then(() => {
this.debouncedFullReload()
})
return
}
debug?.(`handle hmr output for ${shortFile}`, {
...hmrOutput,
code: typeof hmrOutput.code === 'string' ? '[code]' : hmrOutput.code,
})
this.memoryFiles.set(hmrOutput.filename, { source: hmrOutput.code })
if (hmrOutput.sourcemapFilename && hmrOutput.sourcemap) {
this.memoryFiles.set(hmrOutput.sourcemapFilename, {
source: hmrOutput.sourcemap,
})
}
const updates: Update[] = hmrOutput.hmrBoundaries.map((boundary: any) => {
return {
type: 'js-update',
url: hmrOutput.filename,
path: boundary.boundary,
acceptedPath: boundary.acceptedVia,
firstInvalidatedBy: invalidateInformation?.firstInvalidatedBy,
timestamp: Date.now(),
}
})
client.send({
type: 'update',
updates,
})
this.logger.info(
colors.green(`hmr update `) +
colors.dim([...new Set(updates.map((u) => u.path))].join(', ')),
{ clear: !invalidateInformation, timestamp: true },
)
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does handleHmrOutput() do?
handleHmrOutput() is a function in the vite codebase, defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts.
Where is handleHmrOutput() defined?
handleHmrOutput() is defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts at line 312.
What does handleHmrOutput() call?
handleHmrOutput() calls 2 function(s): getShortName, set.
What calls handleHmrOutput()?
handleHmrOutput() is called by 2 function(s): invalidateModule, listen.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free