Fix jumping to patched module source for new React Dev Tools (#3418)

This commit is contained in:
Suffocate 2025-05-16 00:16:51 +01:00 committed by GitHub
parent c2e5dcc384
commit 8023b1be95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View file

@ -581,7 +581,7 @@ function patchFactory(moduleId: PropertyKey, originalFactory: AnyModuleFactory):
}
code = newCode;
patchedSource = `// Webpack Module ${String(moduleId)} - Patched by ${pluginsList.join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${String(moduleId)}`;
patchedSource = `// Webpack Module ${String(moduleId)} - Patched by ${pluginsList.join(", ")}\n${newCode}\n//# sourceURL=file:///WebpackModule${String(moduleId)}`;
patchedFactory = (0, eval)(patchedSource);
if (!patchedBy.has(patch.plugin)) {

View file

@ -751,7 +751,7 @@ export function extract(id: string | number) {
// This module is NOT ACTUALLY USED! This means putting breakpoints will have NO EFFECT!!
0,${mod.toString()}
//# sourceURL=ExtractedWebpackModule${id}
//# sourceURL=file:///ExtractedWebpackModule${id}
`;
const extracted = (0, eval)(code);
return extracted as Function;