Questions tagged [source-maps]

A source map allows a JavaScript debugger to map line and symbol information from a transformed (eg. minified, optimized) JavaScript file back to the original input file used for the transformation. The original file can be any kind of text file which in effect enables in-browser debugging of any language compiling to JavaScript.

JavaScript code used on websites has often gone through various stages of automated transformation (eg. minification, optimization, etc.), or have even been generated from a non-JavaScript source language targeting JavaScript as the runtime environment. These automated translations often make the final code much more difficult to understand and debug using development tools inside the browser.

Source maps solve the problem by giving the JavaScript debugger enough additional information to effectively translate locations and symbols between the processed JavaScript code and the original input file used to create it.

JavaScript source maps is a technology proposal from Google and Mozilla, and currently developed inside the Closure Compiler, WebKit, and Mozilla's DevTools.

Because source maps are not yet officially released and documented, good information about them is somewhat scarce. The following articles give an overview of the current state of source maps:

1111 questions
15
votes
2 answers

Webpack 4 devtool option does not work with webpack-dev-server

Before I decided to post this issue, I did quite a few things as a background check. So, my problem is: - I use webpack v4.6.0 and webpack-dev-server v3.1.3 - they work fine together, but now I am trying to set up source maps for my application, it…
margarita
  • 884
  • 1
  • 10
  • 21
15
votes
3 answers

Typescript + gulp-sourcemaps generates map but browser DevTools don't recognize it

Using Typescript 1.8, Gulp 3.9.0, gulp-sourcemaps 1.6.0, and a tsconfig.json file. At one point a long time ago this was working fine. Of late (and I can't pinpoint when), neither Chrome nor Firefox will actually use the sourcemap. I've enabled…
15
votes
1 answer

How to debug why MS Edge/IE11 does not load sourcemap

I made some source+map concatenation and result works in Firefox and Chrome, but does not even request bundle.js.map from webserver in MS Edge and IE11. Actual JS file is served from http://localhost:8080/bundle.js bundle.js ends with line: //#…
Bobris
  • 415
  • 1
  • 3
  • 14
15
votes
1 answer

Mangled names in debugger with source maps

The debugger in Chrome/Safari does not show unmangled variable names when using source maps generated with grunt-contrib-uglify. Source code is displayed and debugged correctly. I have verified that the source map contains the variable names. Is…
15
votes
4 answers
14
votes
2 answers

chrome, source map not loading

I am generating the bundled.js file using webpack for a typical angular project. Now I deploy this on the web server. The bundle.js file has the following at the end //# sourceMappingURL=main.bundle.js.map However Chrome does not seem to detect…
tmp dev
  • 8,043
  • 16
  • 53
  • 108
14
votes
1 answer

Chrome not requesting JS source map, but Firefox does

I'm using webpack to build my client JS with the devtool: 'source-map' option, so my JS bundle ends in //# sourceMappingURL=app.bundle.js.map. When I open chrome devtools, Chrome shows a "Source Map detected" banner but does not actually show the…
14
votes
2 answers

Missing sourcemaps in Typescript + Webpack project

I've created a Github repo that has all the source code related to this question. I'm able to load build/index.html in the browser after running npm install. However, when I view the sources tab in Chrome, I don't see the source maps associated with…
wmock
  • 5,382
  • 4
  • 40
  • 62
14
votes
2 answers

Django: Make JS source maps compatible with staticfiles filename hashing

In our Django project we are using Gulp to compile our assets, then UglifyJS to minify them. During this whole process we are generating sourcemaps, which appear to be working correctly. The problem comes when we use the Django static template tag…
Joel Cross
  • 1,400
  • 15
  • 22
14
votes
2 answers

Can I translate a stacktrace from minified code into a human readable stacktrace using sourcemaps?

I have some errors from minified code in production. I have sourcemaps not in production. I'd like to (after the fact) use source maps in a way to convert my stack trace into a human readable stack trace. Has anyone done this before?
Parris
  • 17,833
  • 17
  • 90
  • 133
14
votes
1 answer

Show sourcemaps in Chrome network tab

I am starting to use source maps for my SASS code for debugging in Chrome. The way I understood it to work was that Chrome requested in the stylesheet resource and the .map resource, yet I only see the stylesheet showing up in the network tab. I…
Jonathon Blok
  • 749
  • 4
  • 14
14
votes
1 answer

How can I get the original line number and symbol from a sourcemap

I'm logging javascript errors from my site, but the files are minimized so I don't get meaningful line numbers. I do have source maps, however. Is there a service, script, npm module, or anything that can help me "translate" the line numbers from…
blockhead
  • 9,655
  • 3
  • 43
  • 69
14
votes
3 answers

CoffeeScript source maps for nodeJS development

Now that CoffeeScript supports the new Source Map hotness, I was wondering if I can also use the source maps not just in my browser, but on the command line while developing my nodeJS apps. I want the JS compiler to give me more useful error traces…
Sebastian Hoitz
  • 9,343
  • 13
  • 61
  • 77
13
votes
1 answer

Webpack > Cannot debug with original source code (JSX etc)

I'm trying to find the issue with this Webpack configuration. I cannot debug with original source in REACT. Currently, I'm using Chrome dev tools. Issue: Expected: And here my dependencies "babel-loader": "^7.1.0", "babel-plugin-lodash":…
taile
  • 2,738
  • 17
  • 29
13
votes
3 answers

webpack + babel loader source map references empty file

I have an es6 project which I bundle using webpack + babel loader. When I open the devtools I can see 'webpack://' and all my sources (es6) underneath. The problems are: breakpoints don't hit and function references directs me to a file name…
Gal Ziv
  • 6,890
  • 10
  • 32
  • 43