Skip to content

Commit

Permalink
Re-add typescript check when adding react-docgen-typescript plugin (#509
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joshwooding authored Oct 7, 2022
1 parent e348165 commit 64879c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/builder-vite/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ export async function pluginConfig(options: ExtendedOptions, _type: PluginConfig
{} as TypescriptConfig
);

if (reactDocgenOption === 'react-docgen-typescript') {
let typescriptPresent;

try {
require.resolve('typescript');
typescriptPresent = true;
} catch (e) {
typescriptPresent = false;
}

if (reactDocgenOption === 'react-docgen-typescript' && typescriptPresent) {
plugins.push(
require('@joshwooding/vite-plugin-react-docgen-typescript')({
...reactDocgenTypescriptOptions,
Expand Down

0 comments on commit 64879c1

Please sign in to comment.