mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
add nocache option to loadMainConfig
This commit is contained in:
parent
2d280e6629
commit
17a2d4aeed
@ -5,10 +5,18 @@ import { validateConfigurationFiles } from './validate-configuration-files';
|
||||
|
||||
export async function loadMainConfig({
|
||||
configDir = '.storybook',
|
||||
noCache = false,
|
||||
}: {
|
||||
configDir: string;
|
||||
noCache?: boolean;
|
||||
}): Promise<StorybookConfig> {
|
||||
await validateConfigurationFiles(configDir);
|
||||
|
||||
return serverRequire(path.resolve(configDir, 'main'));
|
||||
const mainJsPath = path.resolve(configDir, 'main');
|
||||
|
||||
if (noCache && require.cache[require.resolve(mainJsPath)]) {
|
||||
delete require.cache[require.resolve(mainJsPath)];
|
||||
}
|
||||
|
||||
return serverRequire(mainJsPath);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user