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

Function withBuild

playground/css-dynamic-import/__tests__/css-dynamic-import.spec.ts:20–31  ·  view source on GitHub ↗
(base: string, fn: () => Promise<void>)

Source from the content-addressed store, hash-verified

18})
19
20async function withBuild(base: string, fn: () => Promise<void>) {
21 const config = getConfig(base)
22 await build(config)
23 const server = await preview(config)
24
25 try {
26 await page.goto(server.resolvedUrls.local[0])
27 await fn()
28 } finally {
29 server.httpServer.close()
30 }
31}
32
33async function withServe(base: string, fn: () => Promise<void>) {
34 const config = getConfig(base)

Callers 1

Calls 5

buildFunction · 0.90
previewFunction · 0.90
getConfigFunction · 0.70
closeMethod · 0.65
fnFunction · 0.50

Tested by

no test coverage detected