15

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 this a bug in uglify?

Original source:

// two

function two()
{
    var test = "test";

    console.log("this is a " + test);
}

Generated source:

function two(){var a="test";console.log("this is a "+a)}
//# sourceMappingURL=all.min.js.map

Source map:

{
    "version": 3,
    "file": "all.min.js",
    "sources": ["../src/two.js"],
    "names": ["two","test","console","log"],
    "mappings":";;AAEA,QAASA,OAEL,GAAIC,GAAO,MAEXC,SAAQC,IAAI,aAAeF",
    "sourceRoot":"../"
}
bignose
  • 30,281
  • 14
  • 77
  • 110
Aparajita
  • 508
  • 3
  • 8
  • 6
    There is issue: https://code.google.com/p/chromium/issues/detail?id=327092 – raidendev Mar 18 '15 at 07:11
  • I would suggest setting your grunt-contrib-uglify settings to include `{ compress: false, mangle: false }`. Although this increases the size of the minified file it may alleviate the problems you're seeing – Adam Botley Jul 13 '16 at 14:49

1 Answers1

3

As noted by @rd5, this is issue 327092 in Google Chrome, reported on 2013-12-09.

As of 2018-07-01, the issue is still unresolved.

bignose
  • 30,281
  • 14
  • 77
  • 110
  • Is this still an issue? I have seen this for example with a source map, and the source map contains the full source code https://spectrum.chat/create-react-app/general/sourcemaps-not-working-in-production~2995d466-e080-4d35-8151-bad3e7f8fb98 e.g. the "sourcesContent" in the js.map files – Colin D Jul 20 '20 at 14:12