Skip to content

Instantly share code, notes, and snippets.

@w00kie
Last active December 15, 2015 02:09
Show Gist options
  • Save w00kie/5185431 to your computer and use it in GitHub Desktop.
Save w00kie/5185431 to your computer and use it in GitHub Desktop.

Test Sourcemaps in Chrome Extensions

Opening background.html directly in Chrome will show the coffee file when inspecting javascript error. However when the code is loaded as an extension, only the compiled javascript is shown, ignoring the sourcemap.

Related to Chromium issue 212374.

# Some stupid code that will issue an error
foo = 2
derp = foo*2 + bar
console.debug "Should have been an error right there."
<!DOCTYPE html>
<html>
<script type="text/javascript" src="background.js"></script>
<body></body>
</html>
// Generated by CoffeeScript 1.6.2
(function() {
var derp, foo;
foo = 2;
derp = foo * 2 + bar;
console.debug("Should have been an error right there.");
}).call(this);
/*
//@ sourceMappingURL=background.map
*/
{
"version": 3,
"file": "background.js",
"sourceRoot": "",
"sources": [
"background.coffee"
],
"names": [],
"mappings": ";AAEA;CAAA,KAAA,GAAA;;CAAA,CAAA,CAAA;;CAAA,CAEA,CAAO,CAAP;;CAFA,CAIA,GAAA,EAAO,iCAAP;CAJA"
}
{
"name": "Test Sourcemaps in Chrome Extensions",
"version": "0.1",
"manifest_version": 2,
"description": "Sourcemaps don't work in Chrome Extensions.",
"background": {
"page": "background.html"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment