mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
Core: Fix frameworkOptions preset
This commit is contained in:
parent
aff724ae0c
commit
91389d57a5
@ -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',
|
||||
@ -50,7 +50,7 @@ export const getConfig: WebpackBuilder['getConfig'] = async (options) => {
|
||||
...options,
|
||||
babelOptions,
|
||||
typescriptOptions,
|
||||
frameworkOptions: typeof framework === 'string' ? {} : framework?.options,
|
||||
frameworkOptions,
|
||||
}
|
||||
) as any;
|
||||
};
|
||||
|
@ -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 = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user