Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request contains 3 slightly related patches to the Source Maps support related to Babel/Sass assets.
source
path on source maps from theBabelProcessor
so the browser can request the asset original source, replacing the relative path that was used before.source
when processing the source map. This was causing issues on my app where Sprockets was getting lost on trying to load.css
files as.scss
ones - considering that theSourceMapProcessor
already has thelink
value for each source, we can use it instead of (re)loading the file.@import
ed files (thesource
value ends up being the absolute path for each stylesheet that was imported). I'm not 100% happy with callingresolve!
+load
inside the processor, but was the only way to transform the absolute file path into the source path I could think of. This patch can be easily test on a public app like Code Triage by inspecting the loaded sources. I haven't tested if the same happens with the Sassc processor, but we can duplicate the test case and see how it goes.Let me know what makes sense/doesn't make sense of these patches, I can remove/rework any of those commits as we need.
I still believe that the source maps support here isn't 100%, as some of my exploratory tests on Google Chrome has showed some mismatches between the source contents and the positions reported by the console, but I don't have enough experience on Source Maps to rule this as an issue with the generated map or with the browser support - but I think those patches are a step forward on this.
Thanks @rafaelfranca for walking through and explaining the current implementation when debugging the first two patches with me yesterday ❤️.