diff --git a/packages/babel-cli/bin/babel/dir.js b/packages/babel-cli/bin/babel/dir.js index 6c7b2f41cc..43c401046d 100644 --- a/packages/babel-cli/bin/babel/dir.js +++ b/packages/babel-cli/bin/babel/dir.js @@ -14,7 +14,8 @@ module.exports = function (commander, filenames, opts) { var dest = path.join(commander.outDir, relative); var data = util.compile(src, { - sourceFileName: slash(path.relative(dest + "/..", src)) + sourceFileName: slash(path.relative(dest + "/..", src)), + sourceMapName: path.basename(relative) }); if (data.ignored) return; diff --git a/packages/babel-cli/bin/babel/file.js b/packages/babel-cli/bin/babel/file.js index 7830fb67b4..b03553a8ce 100644 --- a/packages/babel-cli/bin/babel/file.js +++ b/packages/babel-cli/bin/babel/file.js @@ -16,7 +16,8 @@ module.exports = function (commander, filenames, opts) { var buildResult = function () { var map = new sourceMap.SourceMapGenerator({ - file: slash(commander.outFile || "stdout") + file: path.basename(commander.outFile) || "stdout", + sourceRoot: opts.sourceRoot }); var code = "";