Frequently Asked Questions

Table of Contents

How do I combined source maps for concatenated files?

Build an index map that refers to the individual pieces. See the spec for details of a index map.

How can I modify the compiled output without corrupting the source map?

For simple modifications such as adding a version or comment, if you can isolate the change into a line by itself, you can modify that line without affecting any other line. This is possible because the source maps are line/column based. This also means that you can append text to the end of the file without modifying the source map.

You can add an entire block of text the the beginning of the file by creating a simple index map see How do I combined source maps for concatenated files?

Can source maps be completely self contained in the generated source?

Yes. Store the text content of your sources in the sourcesContent property of your source map, and then embed your source map into your generated source by using a data:// URI in the //# sourceMappingURL=... comment pragma.