MCPcopy
hub / github.com/vitejs/vite / close

Method close

packages/vite/src/node/server/environment.ts:327–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

325 }
326
327 async close(): Promise<void> {
328 this._closing = true
329
330 this._crawlEndFinder.cancel()
331 await Promise.allSettled([
332 this.pluginContainer.close(),
333 this.bundledDev?.close(),
334 this.depsOptimizer?.close(),
335 // WebSocketServer is independent of HotChannel and should not be closed on environment close
336 isWebSocketServer in this.hot ? Promise.resolve() : this.hot.close(),
337 (async () => {
338 while (this._pendingRequests.size > 0) {
339 await Promise.allSettled(
340 [...this._pendingRequests.values()].map(
341 (pending) => pending.request,
342 ),
343 )
344 }
345 })(),
346 ])
347 }
348
349 /**
350 * Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports

Callers

nothing calls this directly

Calls 2

closeMethod · 0.65
resolveMethod · 0.65

Tested by

no test coverage detected