Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactVite: Docgen ignore un-parsable files #26254

Merged
merged 14 commits into from
Mar 1, 2024
Prev Previous commit
Next Next commit
fix issue with files without extension
  • Loading branch information
ndelangen committed Feb 29, 2024
commit 686867f6d014346b64d375a91ef041cc9bf8fd31
6 changes: 4 additions & 2 deletions code/frameworks/react-vite/src/plugins/react-docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ export function reactDocgen({
resolver: defaultResolver,
handlers,
importer: makeFsImporter((filename, basedir) => {
if (!filename.match(/\.(mjs|tsx?|jsx?)$/)) {
const result = defaultLookupModule(filename, basedir);

if (!result.match(/\.(mjs|tsx?|jsx?)$/)) {
throw new ReactDocgenResolveError(filename);
}

return defaultLookupModule(filename, basedir);
return result;
}),
filename: id,
}) as DocObj[];
Expand Down
Loading