-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Labels
needs-triageUnconfirmed issuesUnconfirmed issues
Description
When calling SourceMapGenerator.fromSourceMap
with a SourceMapConsumer
for an index map, the following error is thrown:
TypeError: Cannot read property 'replace' of undefined
at Object.relative (C:\dev\scratch\source-map-test\node_modules\source-map\lib\util.js:255:17)
at C:\dev\scratch\source-map-test\node_modules\source-map\lib\source-map-generator.js:75:31
at Array.forEach (<anonymous>)
at Function.fromSourceMap (C:\dev\scratch\source-map-test\node_modules\source-map\lib\source-map-generator.js:72:32)
at test (C:\dev\scratch\source-map-test\test.js:17:52)
at <anonymous>
test.js
const sourcemap = require("source-map");
async function test() {
const map = {
file: "generated.js",
version: 3,
sections: [
{ offset: { column: 0, line: 0 }, map: {
file: "part.js",
version: 3,
sources: ["source.js"],
mappings: "",
names: []
} }
]
};
const consumer = await new sourcemap.SourceMapConsumer(map);
const generator = sourcemap.SourceMapGenerator.fromSourceMap(consumer); // TypeError
}
The error seems to be due to a strict inequality (!==
) check on sourceRoot
whereas all other checks against sourceRoot
use loose inequality (!=
).
Metadata
Metadata
Assignees
Labels
needs-triageUnconfirmed issuesUnconfirmed issues