question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack source maps are broken for debugging in Firefox

See original GitHub issue

I’ve put together a quick repo to demonstrate the problem: https://github.com/Stuk/webpack-sourcemaps-firefox

And here’s a gif of the issue in action:

screencap

I’ve checked Uglify, and Firefox has no issues there. I’ve tried the different config options for devtool:

  • eval - works
  • cheap-eval-source-map - works
  • cheap-source-map - does not work
  • cheap-module-eval-source-map - works
  • cheap-module-source-map - does not work
  • eval-source-map - works
  • source-map - does not work

So seems like eval is file, but an external sourcemap for multiple files does not.

Any thoughts about what’s going on?

I’ve also filed an issue on Bugzilla, in case this is a FF devtools issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1177329

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:42
  • Comments:80 (13 by maintainers)

github_iconTop GitHub Comments

18reactions
digitaraldcommented, May 30, 2019

👋🏻 Firefox DevTools PM here.

I am collecting any remaining source-map issues after we fixed a whole lot in the past releases (summarized in my hacks article). I was glad to see that this a few issues mentioned here seem to be addressed, but I want to make sure.

We need your help 🙏. Please post if any remaining source map issues with the webpack configurations, potentially STRs or even open source projects that are affected. To let us understand our impact so far, please also share if previously broken source maps are working now. Feel free to reach out directly.

16reactions
rplcommented, Jul 4, 2018

@wis @viorelsfetea @jasonLaster the extension’s CSP is not related to those errors, the source maps are fetched from a worker running on the devtools client side and so the CSP of the extension doesn’t have any effect on them.

Currently, a (very annoying) workaround to make the extensions’ sourcemaps available to the source-map worker could be to point the sourceMappingURL=... explicitly to an HTTP url, e.g. by temporarily changing it in the bundled/transpiled file into something like //# sourceMappingURL=http://localhost:8080/bundle.js.map and then make the source maps files available on that url by using something like python -m SimpleHTTPServer . The above workaround is also an additional proof that the extension CSP is not what is triggering this issue.

The actual issue is that Addon Debugging window is currently running in its own separate process and a separate Firefox profile from the Firefox browser instance where the extension is installed, and so the developer tools are trying to fetch the source map from a moz-extension url that is not available locally (where “locally” I mean “in the Toolbox process where the debugger UI and the worker that is fetching and parsing the source maps data are running”).

This issue is tracked by Bug 1437937 (and in this comment there are some details about a possible approach to fix it). To be fair the sources of the source-map module are part of the debugger-html github repo, and so we should probably file an issue also in the github repo, because the fix is likely to require changes to both the mozilla-central (for the changes needed on the “remote debugging server” side) and in the debugger-html repo (for the changes needed to the souce-map module, and on the debugger ui if needed).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source map errors — Firefox Source Docs documentation
You can sometimes encounter problems working with source maps. This page explains the most common problems and how to fix them.
Read more >
sourcemap not working on firefox with Webpack on Angular 2 ...
But i'm having an issue with sourcemaps. I'm not able to see .ts line numbers on Firefox console. What i see instead is...
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
Here are four reasons why your source maps are broken and tips on how ... Debugging Minified JavaScript with Source Maps, before continuing....
Read more >
Source Map Generated By Webpack Works, But Can't Debug ...
Also consider trying the webpack@beta version maybe it's already fixed. >. Do you want Sourcemap is not working for some devtool options. Tested...
Read more >
508270 - Source maps cache not refreshed - chromium
You can tell if you "broke" things because when you refresh the page, any source-mapped files you're viewing in the Source pane won't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found