startServer() — vite Function Reference
Architecture documentation for the startServer() function in index.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD b0471d7e_bd66_5836_5a82_7b67d010354d["startServer()"] a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"] b0471d7e_bd66_5836_5a82_7b67d010354d -->|defined in| a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e 24ecf2a1_3c09_d451_76f3_9485b4e993f8["_createServer()"] 24ecf2a1_3c09_d451_76f3_9485b4e993f8 -->|calls| b0471d7e_bd66_5836_5a82_7b67d010354d de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f["httpServerStart()"] b0471d7e_bd66_5836_5a82_7b67d010354d -->|calls| de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f style b0471d7e_bd66_5836_5a82_7b67d010354d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/server/index.ts lines 1040–1068
async function startServer(
server: ViteDevServer,
hostname: Hostname,
inlinePort?: number,
): Promise<void> {
const httpServer = server.httpServer
if (!httpServer) {
throw new Error('Cannot call server.listen in middleware mode.')
}
const options = server.config.server
const configPort = inlinePort ?? options.port
// When using non strict port for the dev server, the running port can be different from the config one.
// When restarting, the original port may be available but to avoid a switch of URL for the running
// browser tabs, we enforce the previously used port, expect if the config port changed.
const port =
(!configPort || configPort === server._configServerPort
? server._currentServerPort
: configPort) ?? DEFAULT_DEV_PORT
server._configServerPort = configPort
const serverPort = await httpServerStart(httpServer, {
port,
strictPort: options.strictPort,
host: hostname.host,
logger: server.config.logger,
})
server._currentServerPort = serverPort
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does startServer() do?
startServer() is a function in the vite codebase, defined in packages/vite/src/node/server/index.ts.
Where is startServer() defined?
startServer() is defined in packages/vite/src/node/server/index.ts at line 1040.
What does startServer() call?
startServer() calls 1 function(s): httpServerStart.
What calls startServer()?
startServer() is called by 1 function(s): _createServer.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free