Skip to content

Commit

Permalink
Make sources in sourcemap relative to map dir instead of root when no…
Browse files Browse the repository at this point in the history
… prior sourcemap is available
  • Loading branch information
Daniel Gröger committed Apr 5, 2023
1 parent 8e5decf commit 5fe87d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/process-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = async function processFile(inFile, outFile, relativePath, outDi

if (options.sourceMap) {
let newSourceMap = JSON.parse(result.map);
let pathLib = path;

newSourceMap.sources = newSourceMap.sources.map(function(path) {
if (path === relativePath) {
Expand All @@ -76,7 +77,7 @@ module.exports = async function processFile(inFile, outFile, relativePath, outDi
// In broccoli-terser-sourcemap we know in this case we are generating
// sourcemap for the file we are processing, changing 0 to the actual
// file gives us the correct source.
return relativePath;
return pathLib.basename(relativePath);
}
return path;
});
Expand Down

0 comments on commit 5fe87d0

Please sign in to comment.