Use the filepath from builder in the sourceMappingURL ref

This commit is contained in:
Slava Kim
2014-06-16 19:20:19 -07:00
parent d59ab1850d
commit 36004dc435

View File

@@ -1149,14 +1149,15 @@ _.extend(JsImage.prototype, {
if (item.sourceMap) {
// Reference the source map in the source. Looked up later by node-inspector.
var sourceMapBaseName = item.targetPath + ".map";
var sourceMapFileName = path.basename(sourceMapBaseName);
item.source = item.source.concat("\n//# sourceMappingURL=" + sourceMapFileName + "\n");
// Write the source map.
loadItem.sourceMap = builder.writeToGeneratedFilename(
sourceMapBaseName,
{ data: new Buffer(item.sourceMap, 'utf8') }
);
var sourceMapFileName = path.basename(loadItem.sourceMap);
item.source = item.source.concat("\n//# sourceMappingURL=" + sourceMapFileName + "\n");
loadItem.sourceMapRoot = item.sourceMapRoot;
}