From 7258643fbf9d0adb41ca6eb6391a92ff44028b49 Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Mon, 16 Jun 2014 19:32:58 -0700 Subject: [PATCH] For files with source maps, use absolute paths map the stack-trace. If no source map found, don't bother. --- tools/server/boot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/server/boot.js b/tools/server/boot.js index 93c3673e92..16b48d1df6 100644 --- a/tools/server/boot.js +++ b/tools/server/boot.js @@ -57,7 +57,7 @@ _.each(serverJson.load, function (fileInfo) { parsedSourceMap.sourceRoot = path.join( fileInfo.sourceMapRoot, parsedSourceMap.sourceRoot || ''); } - parsedSourceMaps[fileInfo.path] = parsedSourceMap; + parsedSourceMaps[path.resolve(__dirname, fileInfo.path)] = parsedSourceMap; } }); @@ -154,7 +154,9 @@ Fiber(function () { // It is safer to use the absolute path as different tooling, such as // node-inspector, can get confused on relative urls. var absoluteFilePath = path.resolve(__dirname, fileInfo.path); - var func = require('vm').runInThisContext(wrapped, absoluteFilePath, true); + var scriptPath = + parsedSourceMaps[absoluteFilePath] ? absoluteFilePath : fileInfo.path; + var func = require('vm').runInThisContext(wrapped, scriptPath, true); func.call(global, Npm, Assets); // Coffeescript });