-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix relative urls & source maps #390
Fix relative urls & source maps #390
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Looks like I need to fix the tests.
This demonstrates the second issue. The
In this case the source map file is |
I took a look at your solution and don't see a better way. My approach with source maps has been to fix bugs, add tests for them, and cut a beta release. We then wait to see if other people report bugs, and fix those without test regressions. Hopefully we'll catch the majority of edge cases before a RC. I think i'm fine with this as is. Can you modify that failing test so that it passes? Since that is testing the case you're trying to handle, we don't need to add additional test cases. |
Getting an error in the 2.3 tests
|
Strange that it's happening on 2.3.0 but not 2.3.1. Looking into it. |
Agreed, i restarted the test to make sure there wasn't a hiccup and it is still failing. |
Looks like that did it. Not sure why it failed in 2.3.0 but not 2.3.1. Pretty weird. Thanks for your work 🚀 |
This PR fixes two issues related to source maps and relative URLs.
SourceMapCommentProcessor
uses the logical path as the source mapping url which is relative to the load path. However, from the source map revision 3 proposal, the url should be relative to the.debug
file itself. This meant that source maps didn't work when loading assets not located in the assets root directory..map
files. Sources should be linked relative to the.map
file itself, however again they were being linked relative to the load path.I don't believe I have the best solution for this problem, specifically the hack in
source_map_utils.rb
, and it's likely that there are edge cases where it breaks down, but it's necessary to get source maps functioning. I'd love to hear suggestions on ways to improve this solution.fixes #284
@rafaelfranca @bouk