1

So if I have script.js (original file), script.minified.js (minified file) and script.minified.js.map (source map file) - how do I find position in original file based on random position in minified file with the help of source map file?

Example:

I have some position in minified file like script.minified.js:100:30 (meaning it's 100th line and 30th column in the minified file)

What I need to retreive:

Corresponding position in original file like script.js:200:30 (meaning it's 200th line and 30th column in the original file)

A pseudo function would look like:

getOriginalPositionFromMinifiedPosition(minifiedJs, originalJs, sourceMapFile, row, column)
returns [originalRow, originalColumn]

There is a similar qestion but it was left unanswered Google Chrome: how to find original line from minified line using a source map?

0

1 Answer 1

1

Ok, it seems like https://github.com/sokra/source-map-visualization does exactly what I need with mathcing between positions in minified and original files. I knew about this tool but haven't noticed so far it has this functionality as well.

And another tool I've found right now similar to the first one but contains less code. It also performs better with larger source maps compared to the previous project. https://github.com/evanw/source-map-visualization

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.