serve() — vite Function Reference
Architecture documentation for the serve() function in serve.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD ceed2bdd_72e7_e75d_0d0f_878cc624e821["serve()"] e3b26ada_e15e_ab0a_7c4e_c1775a1a4908["serve.ts"] ceed2bdd_72e7_e75d_0d0f_878cc624e821 -->|defined in| e3b26ada_e15e_ab0a_7c4e_c1775a1a4908 style ceed2bdd_72e7_e75d_0d0f_878cc624e821 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
playground/css-lightningcss-proxy/__tests__/serve.ts lines 10–38
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['css/lightningcss-proxy'],
)
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
Source
Frequently Asked Questions
What does serve() do?
serve() is a function in the vite codebase, defined in playground/css-lightningcss-proxy/__tests__/serve.ts.
Where is serve() defined?
serve() is defined in playground/css-lightningcss-proxy/__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