Skip to content

Commit

Permalink
Merge pull request #23019 from storybookjs/tom/wait-to-import-rdtp
Browse files Browse the repository at this point in the history
React: Lazy import `react-docgen-typescript-plugin`
  • Loading branch information
shilman authored Jun 13, 2023
2 parents e7fd8c3 + ccd6813 commit 7d3d2c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions code/presets/react-webpack/src/framework-preset-react-docs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
import { hasDocsOrControls } from '@storybook/docs-tools';

import type { StorybookConfig } from './types';
Expand Down Expand Up @@ -43,11 +42,13 @@ export const webpackFinal: StorybookConfig['webpackFinal'] = async (config, opti
return config;
}

const { ReactDocgenTypeScriptPlugin } = await import('@storybook/react-docgen-typescript-plugin');

return {
...config,
plugins: [
...(config.plugins || []),
new ReactDocgenTypescriptPlugin({
new ReactDocgenTypeScriptPlugin({
...reactDocgenTypescriptOptions,
// We *need* this set so that RDT returns default values in the same format as react-docgen
savePropValueAsString: true,
Expand Down

0 comments on commit 7d3d2c4

Please sign in to comment.