Skip to content

Commit

Permalink
fix: prevent crashing on "--smoke-test" (#400)
Browse files Browse the repository at this point in the history
Fixes #397.

Storybook expects `stats` to match `Stats` interface of `webpack`: https://github.com/webpack/webpack/blob/main/types.d.ts#L11243-L11253.

This type-mismatch is caused by `@storybook/core-common`'s `Builder` and will be fixed by storybookjs/storybook#18377.

- Pass null as optional Stats instead of incorrect structure
  • Loading branch information
AriPerkkio authored May 31, 2022
1 parent fef5a12 commit 2ad9c38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/builder-vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import type { RequestHandler, Request, Response } from 'express';
import type { InlineConfig, UserConfig, ViteDevServer } from 'vite';
import type { ExtendedOptions } from './types';

export interface ViteStats {}
// Storybook's Stats are optional Webpack related property
export type ViteStats = null;

export type ViteBuilder = Builder<UserConfig, ViteStats>;

Expand Down Expand Up @@ -68,7 +69,7 @@ export const start: ViteBuilder['start'] = async ({ startTime, options, router,

return {
bail,
stats: {} as ViteStats,
stats: null,
totalTime: process.hrtime(startTime),
};
};
Expand Down

0 comments on commit 2ad9c38

Please sign in to comment.