Skip to content

Commit

Permalink
fix(cli-bundler): fix source map path for local source file
Browse files Browse the repository at this point in the history
closes #1117
  • Loading branch information
3cp committed Jun 18, 2019
1 parent 112075f commit 7deea6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/build/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,13 @@ exports.Bundle = class {
}

if (sourceMap && parsedPath) {
let sourceRoot = parsedPath.dir.slice(process.cwd().length + 1);
sourceMap.sourceRoot = sourceRoot.replace(/\\/g, '\/');
let sourceRoot = parsedPath.dir.slice(process.cwd().length + 1).replace(/\\/g, '\/');
if (!currentFile.dependencyInclusion) {
// Deal with local source, only use first top folder.
// Because gulp-babel/gulp-typescript already had rest of folder in sourceMap sources field.
sourceRoot = sourceRoot.split('/', 1)[0];
}
sourceMap.sourceRoot = sourceRoot;
needsSourceMap = true;
content = Convert.removeMapFileComments(currentFile.contents);
}
Expand Down

0 comments on commit 7deea6f

Please sign in to comment.