-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Build: Use github URL instead of local path in SJSIR files #91
Conversation
Thanks @ajablonski! I don't actually use source maps myself so I missed this. Question: does it mean we need to add the same to Laminar dependencies to be able to see their sources too? Could you please check if you can see Airstream sources (anything in com.raquo.airstream) from your project, with just this one change? |
Yeah, I think this change would also need to be made in other Laminar dependencies. In my project, which right now directly depends on only Laminar and Airstream, I also saw sourcemap warnings about relative URLs for the transitive dependency scala-dom-types . I'm happy to make PRs in those other repos too, just wanted to start the conversation with one. |
Thanks for checking @ajablonski! I'm not an expert on build stuff, but what you're saying sounds correct. If you could submit similar PRs to SDT and Airstream, that would be great! Otherwise I can do myself next week. |
Oh man am I not an expert in build stuff either; PRs submitted to those other two as well, I spot checked the URLs that ended up in the SJSIR files and they all seemed valid (they were https://raw.githubusercontent.com URLs that correctly resolved instead of file:// local paths) |
Awesome, thanks @ajablonski ! Turns our this option was renamed in Scala 3, so I fixed SDT build like this. |
Ah, nice catch! |
I have all the code ready, just wanted to test that this solves the source maps issue, and if it does, what sbt / scalajs-bundler / webpack config is required for source maps to work. I'm guessing something like this. I should have time to do the release next week(end). |
I'm fairly new to Scala.JS, so apologies if any of the below sounds flat-out wrong, if there's a good reason why a change like this doesn't make sense, or if there's a better solution you've already considered. But here's what I seem to have found:
The source URL that's included in the .sjsir seems to default to the local source path. In certain toolchains that try to include/reference library sources (in my case, that includes scalajs-bundler), this leads to persistent warnings in the webpack process along the lines of this one:
The fix I've seen for this is to use the
mapSourceURI
compiler flag to map to the raw.githubusercontent.com URL, and that seems to change the URL in the sjsir files from a localfile:/
path to a remote one on Github.The perhaps bigger benefit (besides fewer warnings in specific use cases) is that, with this change, I'm able to inspect library sources in the browser when I generate a source map that includes included libraries.