serve() — vite Function Reference
Architecture documentation for the serve() function in serve.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD a6b487d9_a15b_ca55_db5e_4c4e01343336["serve()"] 5c0af01c_9641_2df9_06f7_af0530839340["serve.ts"] a6b487d9_a15b_ca55_db5e_4c4e01343336 -->|defined in| 5c0af01c_9641_2df9_06f7_af0530839340 style a6b487d9_a15b_ca55_db5e_4c4e01343336 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
playground/ssr-pug/__tests__/serve.ts lines 10–35
export async function serve(): Promise<{ close(): Promise<void> }> {
await kill(port)
const { createServer } = await import(path.resolve(rootDir, 'server.js'))
const { app, vite } = await createServer(rootDir, hmrPorts['ssr-pug'])
return new Promise((resolve, reject) => {
try {
const server = app.listen(port, () => {
resolve({
// for test teardown
async close() {
await new Promise((resolve) => {
server.close(resolve)
})
if (vite) {
await vite.close()
}
},
})
})
} catch (e) {
reject(e)
}
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does serve() do?
serve() is a function in the vite codebase, defined in playground/ssr-pug/__tests__/serve.ts.
Where is serve() defined?
serve() is defined in playground/ssr-pug/__tests__/serve.ts at line 10.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free