Enable inline source maps

This commit is contained in:
SteveSandersonMS
2015-11-02 11:32:32 -08:00
parent 60d77e7b92
commit 301657a207
2 changed files with 6 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ namespace ES2015Example.Controllers
{ {
// TODO: Don't hard-code wwwroot; use proper path conversions // TODO: Don't hard-code wwwroot; use proper path conversions
var fileContents = System.IO.File.ReadAllText("wwwroot/" + filename); var fileContents = System.IO.File.ReadAllText("wwwroot/" + filename);
var transpiledResult = await nodeInstance.Invoke("transpilation.js", fileContents); var transpiledResult = await nodeInstance.Invoke("transpilation.js", fileContents, Request.Path.Value);
return Content(transpiledResult, "application/javascript"); return Content(transpiledResult, "application/javascript");
} }
} }

View File

@@ -1,6 +1,9 @@
var babelCore = require('babel-core'); var babelCore = require('babel-core');
module.exports = function(cb, fileContents) { module.exports = function(cb, fileContents, url) {
var result = babelCore.transform(fileContents, {}); var result = babelCore.transform(fileContents, {
sourceMaps: 'inline',
sourceFileName: '/sourcemapped/' + url
});
cb(null, result.code); cb(null, result.code);
} }