chore: make recreateServer optional (#1165)

pull/1166/head
Divyansh Singh 2 years ago committed by GitHub
parent 4a6eda4870
commit 120736fec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -257,7 +257,7 @@ export async function createVitePressPlugin(
) )
try { try {
clearCache() clearCache()
await recreateServer!() await recreateServer?.()
} catch (err) { } catch (err) {
console.error(c.red(`failed to restart server. error:\n`), err) console.error(c.red(`failed to restart server. error:\n`), err)
} }

@ -5,7 +5,7 @@ import { createVitePressPlugin } from './plugin'
export async function createServer( export async function createServer(
root: string = process.cwd(), root: string = process.cwd(),
serverOptions: ServerOptions = {}, serverOptions: ServerOptions = {},
recreateServer: () => Promise<void> recreateServer?: () => Promise<void>
) { ) {
const config = await resolveConfig(root) const config = await resolveConfig(root)

Loading…
Cancel
Save