We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d4fee8 commit 35c501dCopy full SHA for 35c501d
lib/internal/modules/cjs/loader.js
@@ -1648,9 +1648,10 @@ function loadTS(module, filename) {
1648
};
1649
1650
function reconstructErrorStack(err, parentPath, parentSource) {
1651
- const errLine = StringPrototypeSplit(
+ const stackFrames = StringPrototypeSplit(
1652
StringPrototypeSlice(err.stack, StringPrototypeIndexOf(
1653
- err.stack, ' at ')), '\n', 1)[0];
+ err.stack, ' at ')), '\n');
1654
+ const errLine = stackFrames[stackFrames.length - 1];
1655
const { 1: line, 2: col } =
1656
RegExpPrototypeExec(/(\d+):(\d+)\)/, errLine) || [];
1657
if (line && col) {
0 commit comments