Skip to content

source map filename has the wrong name #1312

@doggy8088

Description

@doggy8088

Expected Behavior

Current Behavior

The source map filename is wrong when I assigned a name.

Steps to Reproduce

Here are the steps to reproduce this issue:

  1. Create a.js

    console.log('Hello World')
  2. Run the following command:

    javascript-obfuscator .\a.js -o a.min.js --source-map=true --source-map-file-name=a.min.js.map
  3. The a.min.js is generated.

    function a0_0x388e(){var _0x1d7b85=['250944uqaURh','1169253GDICiC','1101824uSWpIk','14EAccxX','249031YZzwdR','log','2906652QwanhJ','13940790qUNGBk','5nPBmvI','Hello\x20World','1963086IIXTWP','24wsUmaW'];a0_0x388e=function(){return _0x1d7b85;};return a0_0x388e();}var a0_0x29efc7=a0_0x3f6f;function a0_0x3f6f(_0x5bc38f,_0x4dc37e){var _0x388ee9=a0_0x388e();return a0_0x3f6f=function(_0x3f6f29,_0xcefc93){_0x3f6f29=_0x3f6f29-0x102;var _0x287cd8=_0x388ee9[_0x3f6f29];return _0x287cd8;},a0_0x3f6f(_0x5bc38f,_0x4dc37e);}(function(_0x5182ff,_0x55ec5a){var _0x55a395=a0_0x3f6f,_0x5f4f9b=_0x5182ff();while(!![]){try{var _0x323741=parseInt(_0x55a395(0x106))/0x1+-parseInt(_0x55a395(0x105))/0x2*(parseInt(_0x55a395(0x102))/0x3)+-parseInt(_0x55a395(0x104))/0x4+-parseInt(_0x55a395(0x10a))/0x5*(-parseInt(_0x55a395(0x10c))/0x6)+-parseInt(_0x55a395(0x108))/0x7+-parseInt(_0x55a395(0x10d))/0x8*(parseInt(_0x55a395(0x103))/0x9)+parseInt(_0x55a395(0x109))/0xa;if(_0x323741===_0x55ec5a)break;else _0x5f4f9b['push'](_0x5f4f9b['shift']());}catch(_0x3ed595){_0x5f4f9b['push'](_0x5f4f9b['shift']());}}}(a0_0x388e,0x4a4b8),console[a0_0x29efc7(0x107)](a0_0x29efc7(0x10b)));
    //# sourceMappingURL=a.js.map

    🔥 The issue is the sourceMappingURL is wrong. The file name should be a.min.js.map. But it's a.js.map.

  4. The a.min.js.map is generated.

    {"version":3,"sources":["sourceMap"],"names":["console"],"mappings":"4kCAAAA,OAAA,C,kBAAA,E,kBAAA,C","sourcesContent":["console.log('Hello World')"]}

Your Environment

  • Obfuscator version used: 4.1.1_2024-06-15T17:30:18.063Z
  • Node version used: v20.17.0

Stack trace

N/A

Minimal working example that will help to reproduce issue

console.log('Hello World')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions