From b9be2a9a57f733136cd1b01724239808c65e928c Mon Sep 17 00:00:00 2001 From: fi3ework Date: Mon, 30 Dec 2024 19:52:27 +0800 Subject: [PATCH] fix(framework-react): do not hang when react-docgen-typescript throw --- packages/framework-react/src/plugins/react-docgen.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/framework-react/src/plugins/react-docgen.ts b/packages/framework-react/src/plugins/react-docgen.ts index 9e5ebda..c551891 100644 --- a/packages/framework-react/src/plugins/react-docgen.ts +++ b/packages/framework-react/src/plugins/react-docgen.ts @@ -9,7 +9,7 @@ import findUp from 'find-up' import MagicString from 'magic-string' import type { Documentation } from 'react-docgen' import { - ERROR_CODES, + // ERROR_CODES, builtinHandlers as docgenHandlers, builtinResolvers as docgenResolver, makeFsImporter, @@ -101,10 +101,11 @@ export async function reactDocgen({ } } catch (e: any) { // Ignore the error when react-docgen cannot find a react component - if (e.code === ERROR_CODES.MISSING_DEFINITION) { - return src - } - throw e + // if (e.code === ERROR_CODES.MISSING_DEFINITION) { + + // Don't throw in any cases otherwise the watch will hang. + return src + // } } // } },