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

Fix missing path normalization, causing empty sourcesContent in source maps. #823

Merged
merged 2 commits into from
Jul 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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