Search code examples
google-chromegoogle-chrome-extensiongoogle-chrome-devtools

Do source maps work for Chrome extensions?


I'm using the Closure compiler to create a Chrome extension and I'd like to get source maps to work for debugging. I can get source maps to work just fine by pointing the browser directly to a page in my source tree with the special sourceMappingURL added to the end of the compiled javascript file (everything is in a single directory):

debugger;document.getElementById("hello").innerHTML="Hello, world!";
//@ sourceMappingURL=background-compiled.map

But when I access the same script as an extension, I can only see the compiled javascript and not the original source. I do have the Chrome debugger configured to enable source maps in both cases, and otherwise they both execute identically with no errors. Do source maps just not work in extensions or is there something I'm missing in setting things up?

I've tried Chrome 25 stable and Chrome 27 canary, same behavior in both.


Solution

  • In the spirit of providing answers to questions resolved in comments, Chrome previously did not support the use of source maps in extensions but this was rectified as of Chrome 29.

    Thanks to the commenter, @w00kie who filed and tracked the bug on Chromium - if you wish to receive reputation for your helpful effort just post your own answer and I will delete this one.