Skip to content

giansalex/aspnet-bundling-sourcemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bundling SourceMaps

Asp.Net Bundling with source map for Correct Error Logging.

Packages

Steps

In BundleConfig.cs use ScriptWithSourceMapBundle:

bundles.Add(new ScriptWithSourceMapBundle("~/Scripts/app").Include(
    "~/Scripts/log.js",
    "~/Scripts/app.js"));

In js error logging:

window.onerror = function (msg, url, line, col, error) {
    var callback = function(stackframes) {
        // proccess stackFrames:
        // [{columnNumber: 5, fileName: "https://domain.com/Scripts/app.js", functionName:"action", lineNumber:9}]
        console.log(stackframes);
    };
    StackTrace.fromError(error).then(callback);

    return true;
};

Result

Correct row and column position from original source code.

About

Asp.Net Bundling with source map (Sample)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages