Skip to content

Commit

Permalink
If we always add sourceURL even when we have source maps, the native …
Browse files Browse the repository at this point in the history
…stack gets source mappe
  • Loading branch information
sebmarkbage committed Jun 3, 2024
1 parent ec10d2a commit 67ec4a3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1614,10 +1614,6 @@ function resolveErrorDev(
} else {
error = callStack();
}
// Overriding the stack isn't really necessary at this point and maybe we should just
// leave the native one. However, the native one gets printed unsource mapped with
// reportError. If that's fixed it might be better to use the native one.
error.stack = stack;
}

(error: any).digest = digest;
Expand Down Expand Up @@ -1723,20 +1719,21 @@ function createFakeFunction<T>(
// point to the original source.
let code;
if (line <= 1) {
code = '_=>' + ' '.repeat(col < 4 ? 0 : col - 4) + '_()\n' + comment + '\n';
code = '_=>' + ' '.repeat(col < 4 ? 0 : col - 4) + '_()\n' + comment;
} else {
code =
comment +
'\n'.repeat(line - 2) +
'_=>\n' +
' '.repeat(col < 1 ? 0 : col - 1) +
'_()\n';
'_()';
}

if (filename) {
code += '\n//# sourceURL=' + filename;
}
if (sourceMap) {
code += '//# sourceMappingURL=' + sourceMap;
} else if (filename) {
code += '//# sourceURL=' + filename;
code += '\n//# sourceMappingURL=' + sourceMap;
}

let fn: FakeFunction<T>;
Expand Down

0 comments on commit 67ec4a3

Please sign in to comment.