The sources field in the generated sourceMap is always ["sourceMap"]
See original GitHub issueI 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)
- create a file ‘a.js’
- the first line of ‘a.js’ should
require('source-map-support').install();
. - throw error in ‘a.js’, use
console.log()
print the error stack - do obfuscate with the config above
- run the obfuscated
a.js
- 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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Source Map Revision 3 Proposal
The original source map format (v1) was created by Joseph Schorr for use by Closure Inspector to enable ... Always present if there...
Read more >Anatomy of source maps | Bugsnag Blog
Source maps help you debug errors in your JavaScript code by mapping minified code to your original source. Learn how source maps work...
Read more >Source Maps are Great … When You Get It Right | by Coursera
sourcesContent is an array field in sourcemaps where you can embed the original source into the map itself. this means you no longer...
Read more >How to set up source maps to help debug production JavaScript
Developers can use source maps to map transpiled code back to their original source code. These five tips help developers get source maps ......
Read more >Use a source map — Firefox Source Docs documentation
A source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Obfuscator has two interfaces: CLI and Node API.
With CLI - obfuscator reads file and know file name of this file. With CLI obfuscator passing internally
inputFileName
based on name of the input file, and as result - you wont to do this manually.inputFileName
is not available with CLI.With Node API (all plugins are using this variant) obfuscator knows nothing about files. It obfuscating strings with source code and you should pass
inputFileName
value, so obfuscator will know name of the file that contains source code.Fix in
master
branch now. Until release you can use version frommaster
branch.When 0.17.0 will released, you have two options:
inputFileName
optioninputFileName
option.