1

We have some JavaScript that is output generated by a compiler that also created a source-map.

Now I'd like to do some simple work on this output JS like adding some lines or stripping some code. But it has to be done in a way that would also update the source-map so it stays valid for the changed code.

Is this possible?

6
  • 2
    Why can't you edit the original code? Commented Mar 27, 2014 at 16:36
  • the desired changes cannot be expressed with the original language or toolchain (which is why I want to post-process). Commented Mar 27, 2014 at 17:57
  • OK, I see. Still, even if not relevant for the question, I'm curious what compiler you are using and what parts of the output code you need to manipulate? Commented Mar 27, 2014 at 18:13
  • In my practical case I use TypeScript and want to do all kinds of creative stuff with the JS output. Like concatenating files, splicing substrings etc. Commented Mar 27, 2014 at 18:19
  • 1
    So you don't want to modify what the code does, but only move parts of it around? You might want to have a look at Generating source maps for multiple concatenated javascript files then. Commented Mar 27, 2014 at 19:24

1 Answer 1

0

You need to work on the source code, or you will have to generate a new sourcemap from the new one.

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.