storybook/docs/snippets/common/storybook-builder-api-shutdown-server.ts.mdx
2022-05-05 23:37:51 +01:00

24 lines
541 B
Plaintext

```ts
// index.ts
import { createViteServer } from './vite-server';
export const start: ViteBuilder['start'] = async ({ options, server: devServer }) => {
// Remainder implementation goes here
const server = await createViteServer(options as ExtendedOptions, devServer);
async function bail(e?: Error): Promise<void> {
try {
return await server.close();
} catch (err) {
console.warn('unable to close the server');
}
throw e;
}
return {
bail,
totalTime: process.hrtime(startTime),
};
};
```