Merge pull request #3108 from cspotcode/feature/fix-T2864
source-maps: Fix T2864
This commit is contained in:
commit
c8a6d8117d
@ -359,21 +359,28 @@ export default class File extends Store {
|
||||
sourceRoot: inputMapConsumer.sourceRoot
|
||||
});
|
||||
|
||||
// This assumes the output map always has a single source, since Babel always compiles a single source file to a
|
||||
// single output file.
|
||||
const source = outputMapConsumer.sources[0];
|
||||
|
||||
inputMapConsumer.eachMapping(function (mapping) {
|
||||
mergedGenerator.addMapping({
|
||||
source: mapping.source,
|
||||
|
||||
original: {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
},
|
||||
|
||||
generated: outputMapConsumer.generatedPositionFor({
|
||||
line: mapping.generatedLine,
|
||||
column: mapping.generatedColumn,
|
||||
source: outputMapConsumer.file
|
||||
})
|
||||
const generatedPosition = outputMapConsumer.generatedPositionFor({
|
||||
line: mapping.generatedLine,
|
||||
column: mapping.generatedColumn,
|
||||
source: source
|
||||
});
|
||||
if(generatedPosition.column != null) {
|
||||
mergedGenerator.addMapping({
|
||||
source: mapping.source,
|
||||
|
||||
original: {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
},
|
||||
|
||||
generated: generatedPosition
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let mergedMap = mergedGenerator.toJSON();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user