Skip to content

Commit

Permalink
Fix sourcemaps for Webpack5
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed May 24, 2024
1 parent c106a52 commit a9f1e1d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion code/presets/react-webpack/src/loaders/react-docgen-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@ export default async function reactDocgenLoader(
}
});

callback(null, magicString.toString(), map);
callback(
null,
magicString.toString(),
map ??
magicString.generateMap({
hires: true,
source: this.resourcePath,
includeContent: true,
})
);
} catch (error: any) {
if (error.code === ERROR_CODES.MISSING_DEFINITION) {
callback(null, source);
Expand Down

0 comments on commit a9f1e1d

Please sign in to comment.