Skip to content

Invalid line numbers #36

@dhbaird

Description

@dhbaird

Stack traces are producing incorrect line numbers.

Steps to reproduce:

uglifysanity.js:

console.log('1');
goober();
console.log('2');
console.log('3');
console.log('4');
console.log('5');

Then run it through uglify:

uglifyjs -c -m -o uglifysanity.min.js \
         --source-map uglifysanity.min.js.map \
         uglifysanity.js

Finally, test it in node:

require('source-map-support').install();
require('./uglifysanity.min');

And it produces this output:

.../uglifysanity.min.js:1
exports, require, module, __filename, __dirname) { console.log("1"),goober(),c
                                                                    ^

.../uglifysanity.js:6
console.log('5');                     <---------- Wrong line!
^
ReferenceError: goober is not defined
    at Object.<anonymous> (.../uglifysanity.js:6:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [stdin]:5:1
    at Object.<anonymous> ([stdin]-wrapper:6:22)
    at Module._compile (module.js:456:26)

Expect this instead:

.../uglifysanity.js:2
goober();
^

In Chrome, this seems to work fine. Just not working in Node.js. I'm using source-map-support@0.2.8 and uglify-js@2.4.15 and Node v0.10.25.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions