Skip to content
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 sources in source maps #37

Closed
artursoler opened this issue Aug 31, 2014 · 19 comments
Closed

Fix sources in source maps #37

artursoler opened this issue Aug 31, 2014 · 19 comments

Comments

@artursoler
Copy link

When using source maps with scalatags, it produces sources which are local to the computer where it has been compiled.

I first opened an issue in scala-js, thinking it was a compiler's issue. The available fix is explained in there: scala-js/scala-js#993

@japgolly
Copy link
Contributor

japgolly commented Sep 8, 2014

@lihaoyi This project doesn't have any Git tags (which I was going to use in the source map URL). Are you not tagging or have you just not pushed the tags via git push --tags?

@lihaoyi
Copy link
Member

lihaoyi commented Sep 8, 2014

I haven't been tagging my git versions =< I've been lazy and just leaving the versions as commit messages. I assume you want git tags because you can get construct a URL on github which points to a particular tag?

@japgolly
Copy link
Contributor

japgolly commented Sep 8, 2014

Bingo. I closed a similar request for scalajs-react with japgolly/scalajs-react@1541a16 and was going to do the same here, then realised no tags.

@lihaoyi
Copy link
Member

lihaoyi commented Sep 8, 2014

Hmm ok, I guess I could publish a new version properly tagged and redirect the source maps at the same time

@japgolly
Copy link
Contributor

japgolly commented Sep 8, 2014

I find that way to be the easiest. Added bonus is that Github will recognise the tags as releases whereas for scalatags github currently says "0 releases". Git also allows you to apply tags retrospectively so you can still tag those past releases if you so wish.

@japgolly
Copy link
Contributor

Here's slightly different method. Just added this for Scalaz.js.
japgolly/scalaz@57be87d

@japgolly
Copy link
Contributor

japgolly commented Oct 9, 2014

Dude, I just upgrade Chrome (to 38.0.2125.101) and it seems they've added source map validation. Just loading a page now gets my JS console spammed with:

Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/generic/Util.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/generic/Bundle.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/generic/Attrs.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/generic/Styles.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/generic/Core.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/target/scala-2.11/src_managed/main/upickle/Generated.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/shared/main/scala/upickle/package.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/shared/main/scala/upickle/Types.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/shared/main/scala/upickle/GeneratedUtil.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/shared/main/scala/upickle/Js.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/shared/main/scala/upickle/Implicits.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/scalatags/js/../shared/main/scala/scalatags/Escaping.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map
Failed to locate workspace file mapped to URL file:///Users/haoyi/Dropbox%20(Personal)/Workspace/upickle/js/src/main/scala/upickle/json/package.scala from source map http://localhost:8080/assets/dev/webapp-client-fastopt.js.map

@lihaoyi
Copy link
Member

lihaoyi commented Oct 9, 2014

oops =/ Is this the kind of thing you can create a PR for? I've been busy with work and haven't had time to come back to this

@lihaoyi
Copy link
Member

lihaoyi commented Oct 9, 2014

If you want-to/can send a PR with a fix, I'll happily take it ^_^

japgolly added a commit to japgolly/scalatags that referenced this issue Oct 10, 2014
@japgolly
Copy link
Contributor

Yeah, no worries. For the PR to effective though, you'll need to start tagging and pushing the tags.

@japgolly
Copy link
Contributor

Btw I just followed what seemed to be the norm for the tagging format, which is "v" + <version>. So 0.4.0 will expect a tag called v0.4.0

lihaoyi added a commit that referenced this issue Oct 10, 2014
Use Github URL in source maps (#37)
@lihaoyi
Copy link
Member

lihaoyi commented Oct 10, 2014

I just published 0.4.2 which should be published with the corrected source maps, but is otherwise identical to 0.4.1. Try it out and feel free to reopen if it doesn't work =)

@lihaoyi lihaoyi closed this as completed Oct 10, 2014
@japgolly
Copy link
Contributor

Will do. Thanks!

On 10 October 2014 14:40, Li Haoyi notifications@github.com wrote:

I just published 0.4.2 which should be published with the corrected source
maps, but is otherwise identical to 0.4.1. Try it out and feel free to
reopen if it doesn't work =)


Reply to this email directly or view it on GitHub
#37 (comment).

@japgolly
Copy link
Contributor

@lihaoyi It appears you forgot to push the v0.4.2 tag :)

@japgolly
Copy link
Contributor

Just tested this and can confirm: The source maps are pointing to github instead of spamming console. Great. Just need to push that tag and we're done.

@lihaoyi
Copy link
Member

lihaoyi commented Oct 13, 2014

Oops, I think I just pushed the tag, try again?

@japgolly
Copy link
Contributor

Bad news, it seems that GitHub doesn't follow symlinks so everything under js/shared doesn't work.

The source map tries to access:
https://raw.githubusercontent.com/lihaoyi/scalatags/v0.4.2/js/shared/main/scala/scalatags/generic/Attrs.scala

As sourcemaps are only needed for JS, a hacky workaround would be to make js/shared the real dir, and point shared to it instead. Flip the source & target. Just an idea. Up to you :)

@lihaoyi
Copy link
Member

lihaoyi commented Oct 18, 2014

@japgolly I tried the "/js/shared is the real thing, /jvm/shared is symlink, remove /shared" thing and updated the v0.4.2 tag to point at the latest commit. Want to try again?

@lihaoyi lihaoyi reopened this Oct 18, 2014
@japgolly
Copy link
Contributor

That's fixed it. Works perfectly now. Thanks Haoyi!~

@lihaoyi lihaoyi closed this as completed Nov 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants