From 9d3dff3b7addaed7e30daf5dff67968e1649f894 Mon Sep 17 00:00:00 2001 From: "clintwood (Office)" Date: Mon, 18 May 2015 10:11:20 +0200 Subject: [PATCH] correct cli source map file: value, honor sourceRoot when using -o option --- packages/babel-cli/bin/babel/dir.js | 3 ++- packages/babel-cli/bin/babel/file.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 = "";