1

How can I programmatically, using Node/JS, map a specific line/column number in a JS bundle to its source module (using the source map)?

Update: I used the package sourcemap-explorer to find the location in the original source. (e.g. $ sourcemap-explorer bundle.js:1:1234 to find the original source for line 1, column 1234 in bundle.js -- given that bundle.js.map exists in the same directory). Thanks to Phil for the suggestion!

Link: https://www.npmjs.com/package/sourcemap-lookup

Nils
  • 780
  • 5
  • 16
  • What version of IE? – Phil Mar 21 '19 at 00:15
  • IE11 in this instance, but the question is more general: I would love a command line solution! – Nils Mar 21 '19 at 00:17
  • Given it's a runtime error, you won't get anything on the command line – Phil Mar 21 '19 at 00:18
  • Thanks, I rephrased the question now. The error itself isn't really relevant -- I just don't know practically how to use the source map to get the source module given a line/column number. – Nils Mar 21 '19 at 00:23
  • The question you linked to does unfortunately not answer the question. – Nils Mar 21 '19 at 00:24
  • According to the linked post, IE11 _should_ support source maps so you _should_ be able to see the real location of the error – Phil Mar 21 '19 at 00:24
  • I'd be happy to re-open but you'll need to show how IE's debugging tools aren't working for you – Phil Mar 21 '19 at 00:25
  • This might be what you're looking for ~ https://www.npmjs.com/package/sourcemap-lookup – Phil Mar 21 '19 at 00:26
  • Yes, indeed! Thank you. I'll be happy to answer my own question with your suggestion -- I've been searching for something like this quite a while now. – Nils Mar 21 '19 at 00:31
  • Software recommendations are not applicable for StackOverflow answers – Phil Mar 21 '19 at 00:32
  • Very well. Thanks again for the suggestion, though -- appreciate the help. – Nils Mar 21 '19 at 00:32
  • You could edit the link into your question though. I'm sure it will help somebody else and it beats sifting through the comments to find it – Phil Mar 21 '19 at 00:33

0 Answers0