Skip to content

Commit 7deea6f

Browse files
committed
fix(cli-bundler): fix source map path for local source file
closes #1117
1 parent 112075f commit 7deea6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/build/bundle.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,13 @@ exports.Bundle = class {
313313
}
314314

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

0 commit comments

Comments
 (0)