Skip to content

The sources field in the generated sourceMap is always ["sourceMap"] #276

Closed
@zhaochy1990

Description

@zhaochy1990

I obfuscate my code use config

{
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 1,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: false,
    identifierNamesGenerator: 'hexadecimal',
    log: true,
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: true,
    stringArray: true,
    stringArrayEncoding: 'rc4',
    stringArrayThreshold: 1,
    transformObjectKeys: true,
    unicodeEscapeSequence: false,
    sourceMap: true,
    sourceMapMode: 'inline',
}

after I decode the base64 encoded sourceMap, I found "sources":["sourceMap"], this made all the error stack shows the correct line number with wrong filename ''sourceMap"

Expected Behavior

the error stack from a file a.js should have error stack with filename a.js

Current Behavior

the error stack from a file a.js have error stack with filename sourceMap.js

Steps to Reproduce (for bugs)

  1. create a file 'a.js'
  2. the first line of 'a.js' should require('source-map-support').install();.
  3. throw error in 'a.js', use console.log() print the error stack
  4. do obfuscate with the config above
  5. run the obfuscated a.js
  6. the error stack show the bug

Your Environment

  • Version used:
    node: 8.10.0
    javascript-obfuscator: latest

Stack trace

Minimal working example that will help to reproduce issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions