An open API service indexing awesome lists of open source software.

https://github.com/giansalex/aspnet-bundling-sourcemap

Asp.Net Bundling with source map (Sample)
https://github.com/giansalex/aspnet-bundling-sourcemap

aspnet-mvc bundling

Last synced: 6 months ago
JSON representation

Asp.Net Bundling with source map (Sample)

Awesome Lists containing this project

README

          

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

## Packages
- [AspNetBundling](https://github.com/benmccallum/AspNetBundling)
- [stacktrace.js](https://github.com/stacktracejs/stacktrace.js/)

## Steps
In BundleConfig.cs use `ScriptWithSourceMapBundle`:
```csharp

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

```

In js error logging:
```js

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.