google / google/closure-compiler
Configuring source maps is needlessly complicated
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
It is not clear how to generate source maps that can be used to debug code on localhost, which is arguably a very common use case.
What is certain, is that it is necessary to use a combination of compiler flags. One combo that works is the following:
```js
--create_source_map=%outname%.map \
--source_map_include_content=true \
--output_wrapper="%output%//# sourceMappingURL=bundle.js.map"
```
The compiler flags `create_source_map` and `source_map_include_content` [are documented here](https://github.com/google/closure-compiler/wiki/Flags-and-Options#reports), but there is no mention of the fact that you should also use the `output_wrapper` flag.
In order to find out how to generate `sourceMappingURL`, you have to [look through the FAQ](https://github.com/google/closure-compiler/wiki/FAQ#source-maps-and-sourcemappingurl).
_Btw, the FAQ links to an external page `http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/` but this link does not work anymore. However, this is beside the point._
The point is, ideally there would be a small section in the wiki about configuring source maps - with all the details in one place - and this could be referenced from [the compiler flags page](https://github.com/google/closure-compiler/wiki/Flags-and-Options#reports).
Contributor guide
Assessment
This issue has not been assessed yet.