问题
I'm using Firefox v47 on a Mac. I've worked out how to get the Debugger to use JavaScript source maps to show where I'm triggering some code, but it uses the compiled file in the Console. How do I get it to show me the uncompiled file lines?
This works out of the box in Chrome, so seems an odd omission in Firefox so I'm assuming I've done something wrong.
回答1:
In the Firefox Toolbox Settings, enable the option Show original sources
in the Style Editor area. This option should, however, be enabled by default in all Firefox versions >= 35 (source)
There is a seperate article about source map support in Firefox that elaborates on the minimum required Firefox version for sourcemaps to work (Firefox 29).
Also, keep in mind that not all SASS-generated files come with sourcemaps - this is a feature that must be manually enabled with the --sourcemap
argument if you're using it from the command line, by rendering it with render_with_sourcemap
from within a ruby program, or by other means if you're using a task manager such as gulp or grunt.
You can check if your stylesheet has an associated sourcemap by looking at the last non-empty line of your generated css file - it should look somewhat like this:
/*# sourceMappingURL=style.css.map */
回答2:
As of now, this is still a work in progress, see the related note on MDN and a bug ticket describing the problem that brought me to this question. So, for now, source map seem to work well everywhere except in the console.
来源:https://stackoverflow.com/questions/37750699/how-do-i-set-firefox-dev-tools-to-respect-source-maps-in-the-console