warmupFile() — vite Function Reference
Architecture documentation for the warmupFile() function in warmup.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 8b9f9995_7f45_8a00_527d_191c9038ff89["warmupFile()"] c4f5fac4_8500_5acd_037b_a0062bdbd152["warmup.ts"] 8b9f9995_7f45_8a00_527d_191c9038ff89 -->|defined in| c4f5fac4_8500_5acd_037b_a0062bdbd152 b01f20cf_5cfc_d029_236e_628cc3b55b87["warmupFiles()"] b01f20cf_5cfc_d029_236e_628cc3b55b87 -->|calls| 8b9f9995_7f45_8a00_527d_191c9038ff89 88bc01ae_f434_ebd6_6f84_27d3ae6f3a72["htmlFileToUrl()"] 8b9f9995_7f45_8a00_527d_191c9038ff89 -->|calls| 88bc01ae_f434_ebd6_6f84_27d3ae6f3a72 2cf2882d_994f_ba70_1e26_59af3e0aac1c["fileToUrl()"] 8b9f9995_7f45_8a00_527d_191c9038ff89 -->|calls| 2cf2882d_994f_ba70_1e26_59af3e0aac1c a7a71598_1136_b87a_07e7_f81a84ec9ab6["warmupRequest()"] 8b9f9995_7f45_8a00_527d_191c9038ff89 -->|calls| a7a71598_1136_b87a_07e7_f81a84ec9ab6 style 8b9f9995_7f45_8a00_527d_191c9038ff89 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/server/warmup.ts lines 22–53
async function warmupFile(
server: ViteDevServer,
environment: DevEnvironment,
file: string,
) {
// transform html with the `transformIndexHtml` hook as Vite internals would
// pre-transform the imported JS modules linked. this may cause `transformIndexHtml`
// plugins to be executed twice, but that's probably fine.
if (file.endsWith('.html')) {
const url = htmlFileToUrl(file, server.config.root)
if (url) {
try {
const html = await fs.readFile(file, 'utf-8')
await server.transformIndexHtml(url, html)
} catch (e) {
// Unexpected error, log the issue but avoid an unhandled exception
environment.logger.error(
`Pre-transform error (${colors.cyan(file)}): ${e.message}`,
{
error: e,
timestamp: true,
},
)
}
}
}
// for other files, pass it through `transformRequest` with warmup
else {
const url = fileToUrl(file, server.config.root)
await environment.warmupRequest(url)
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does warmupFile() do?
warmupFile() is a function in the vite codebase, defined in packages/vite/src/node/server/warmup.ts.
Where is warmupFile() defined?
warmupFile() is defined in packages/vite/src/node/server/warmup.ts at line 22.
What does warmupFile() call?
warmupFile() calls 3 function(s): fileToUrl, htmlFileToUrl, warmupRequest.
What calls warmupFile()?
warmupFile() is called by 1 function(s): warmupFiles.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free