Skip to content

Commit

Permalink
Merge pull request #18979 from storybookjs/shilman/fix-framework-options
Browse files Browse the repository at this point in the history
Core: Fix frameworkOptions preset
  • Loading branch information
shilman authored Aug 22, 2022
2 parents aff724a + 91389d5 commit 9b71ead
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions code/lib/builder-webpack5/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const getConfig: WebpackBuilder['getConfig'] = async (options) => {
const { presets } = options;
const typescriptOptions = await presets.apply('typescript', {}, options);
const babelOptions = await presets.apply('babel', {}, { ...options, typescriptOptions });
const framework = await presets.apply<any>('framework', {}, options);
const frameworkOptions = await presets.apply<any>('frameworkOptions');

return presets.apply(
'webpack',
Expand All @@ -50,7 +50,7 @@ export const getConfig: WebpackBuilder['getConfig'] = async (options) => {
...options,
babelOptions,
typescriptOptions,
frameworkOptions: typeof framework === 'string' ? {} : framework?.options,
frameworkOptions,
}
) as any;
};
Expand Down
13 changes: 4 additions & 9 deletions code/lib/core-server/src/presets/common-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,18 @@ export const storyIndexers = async (indexers?: StoryIndexer[]) => {
export const frameworkOptions = async (
_: never,
options: Options
): Promise<StorybookConfig['framework']> => {
): Promise<Record<string, any> | null> => {
const config = await options.presets.apply<StorybookConfig['framework']>('framework');

if (typeof config === 'string') {
return {
name: config,
options: {},
};
return {};
}

if (typeof config === 'undefined') {
return null;
}

return {
name: config.name,
options: config.options,
};
return config.options;
};

export const docs = (
Expand Down

0 comments on commit 9b71ead

Please sign in to comment.