storybook/docs/snippets/common/storybook-builder-api-shutdown-server.ts.mdx
2022-12-14 22:22:58 +11:00

22 lines
452 B
Plaintext

```ts
// index.ts
import { createViteServer } from './vite-server';
let server: ViteDevServer;
export async function bail(): Promise<void> {
return server?.close();
}
export const start: ViteBuilder['start'] = async ({ options, server: devServer }) => {
// Remainder implementation goes here
server = await createViteServer(options as ExtendedOptions, devServer);
return {
bail,
totalTime: process.hrtime(startTime),
};
};
```