Open JarekToro opened 2 months ago
in remapping.mjs I added a null check on source. It seems to solve the issues im running into.
function originalPositionFor(source, line, column, name) {
+ if (!source){
+ return null
+ }
if (!source.map) {
return SegmentObject(source.source, line, column, name, source.content, source.ignore);
}
const segment = traceSegment(source.map, line, column);
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
if (segment == null)
return null;
// 1-length segments only move the current generated column, there's no source information
// to gather from it.
if (segment.length === 1)
return SOURCELESS_MAPPING;
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
}
Encountered the same issue with vitest.
It is strange though, that issue happens only in workspace environment in my case.
Adding source
null check solves issue as well.
in case anyone else ends up here, this was fixed for me by upgrading vitest from 1 to 2.1.4
This seems familiar but not the same as these issues. The issues below mention how @jridgewell/trace-mapping had a bug that caused this. And you need a newer version. I have the newest version and am still having the problem.
https://github.com/ampproject/remapping/issues/163 https://github.com/ampproject/remapping/issues/158
I have these versions "name": "@ampproject/remapping", "version": "2.3.0",
"name": "@jridgewell/trace-mapping", "version": "0.3.25",
This is the thrown error