Skip to content

Commit

Permalink
globalize @storybook/blocks if fastBuildEmptyBlocks is set to true
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Nov 1, 2023
1 parent 6538477 commit 9a72ed0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/builders/builder-vite/src/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ export async function commonConfig(

export async function pluginConfig(options: Options) {
const frameworkName = await getFrameworkName(options);
const { features } = options;
const globalsObj: Record<string, string> = globals;

if (features?.fastBuildEmptyBlocks) {
globalsObj['@storybook/blocks'] = '__STORYBOOK_BLOCKS_EMPTY_MODULE__';
}

const plugins = [
codeGeneratorPlugin(options),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ export default async (
`);
}

const globalObj: Record<string, string> = globals;

if (features?.fastBuildEmptyBlocks) {
globalObj['@storybook/blocks'] = '__STORYBOOK_BLOCKS_EMPTY_MODULE__';
}

return {
name: 'preview',
mode: isProd ? 'production' : 'development',
Expand Down

0 comments on commit 9a72ed0

Please sign in to comment.