Closed avk closed 7 years ago
Maybe they expect source map to include source code into sourcesContent
field instead of referencing it in the sources
fields.
Yep, Rollbar confirmed it:
Aha, yes, that is true. Per our docs: "You can include the source inside the source map. We'll look for it in sourcesContent as per the source map standard."
Any thoughts on how to proceed or fix?
https://github.com/AlexanderPavlenko/sprockets_uglifier_with_source_maps/tree/sources_content
You can try this version with config.assets.sourcemaps_embed_source = true
.
@AlexanderPavlenko thanks. I'm not seeing sourcesContent
at the top of the map:
$ head -c115 public/assets/maps/application-2056d377c0539f8327c140dbd4baa97ccb98ca3dfc2526ee12f2df9533124519.js.map
{"version":3,"sources":["?"],"names":["window","goog_snippet_vars","w","google_conversion_id","google_conversion_la
but I do see the key later in the file. Is that expected?
Yes, it's a hash, so the keys order is generally doesn't matter.
@AlexanderPavlenko thanks, I have this working locally but doesn't seem to take in production yet. Is there anything else I may have to do besides config.assets.sourcemaps_embed_source = true
in my production config?
@AlexanderPavlenko this works! Would love to see this in a future release 👍
Version 2.1.0 released.
@AlexanderPavlenko in the output @avk provided I see "sources":["?"]
. I've been investigating and it appears that other UglifyJs2 users have seen this but I'm not sure I understand what the workaround is. Do you know how to get the sources list to contain the actual source filenames?
Thanks!
@AlexanderPavlenko any suggestions?
@coryvirok assuming sources
field is for URLs, original source filenames may be saved as comments inside those sources.
The sources
field is supposed to contain the ordered list of input filenames which the source map was generated from.
E.g. If you minify and generate a source map for files a.js, b.js, c.js you will end up with out.min.js and out.min.map. The sources
key in the sourcemap should contain ["a.js", "b.js", "c.js"]
The order is important here since it corresponds with the VLQ offset for which file the symbol is in. If sources == ["?"]
it essentially breaks sourcemapping.
More info here: https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
But it sounds like fixing the sources
key is out of scope for this library. Is that correct?
Hey @AlexanderPavlenko, thanks for this helpful utility. I'm having a continuous issue with Rollbar not using the default source maps the gem generates. Their support and I haven't been able to get to the bottom of it. This is their latest response:
The minified file
It's corresponding source map
My config only has
config.assets.js_compressor = :uglifier_with_source_maps
The gem looks to be doing everything as expected, according to your example. Any thoughts on what could be the issue?