Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #823 from thomas-darling/master
Browse files Browse the repository at this point in the history
Fix missing path normalization, causing empty sourcesContent in source maps.
  • Loading branch information
guybedford authored Jul 22, 2017
2 parents 8a8dcba + aeb03f2 commit 62aa0ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports.concatenateSourceMaps = function(outFile, mapsWithOffsets, basePath, sou

if (sourceMapContents && map.sourcesContent) {
for (var i=0; i<map.sources.length; i++) {
var source = (map.sourceRoot || '') + map.sources[i];
var source = path.normalize(path.isAbsolute(map.sources[i]) ? map.sources[i] : (map.sourceRoot || '') + map.sources[i]).replace(/\\/g, '/');
if (!source.match(/\/@traceur/)) {
if (!contentsBySource[source]) {
contentsBySource[source] = map.sourcesContent[i];
Expand Down Expand Up @@ -98,7 +98,7 @@ exports.concatenateSourceMaps = function(outFile, mapsWithOffsets, basePath, sou
if (isFileURL(source))
source = fromFileURL(source);

return path.relative(outPath, path.resolve(basePath, source)).replace(/\\/g, '/');
return path.isAbsolute(source) ? source : path.relative(outPath, path.resolve(basePath, source)).replace(/\\/g, '/');
});

return JSON.stringify(normalized);
Expand Down

0 comments on commit 62aa0ba

Please sign in to comment.