ClojureScript

Source map string in JS output is not relative to JS file

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

If I set the following options in lein cljsbuild configuration:

:output-to "js/script.js"
:source-map "js/script.js.map"

This line gets appended to js/script.js:
//@ sourceMappingURL=js/script.js.map

Since this is a relative URL, it is looking for it relative to js/script.js. Therefore, the browser looks in js/js/script.js.map.

The URL should be relative to the location of the output JS file.

  1. clojurescript-source-map.patch
    16/Sep/13 3:54 PM
    2 kB
    Eric Normand
  2. source-map2.patch
    11/Oct/13 11:36 AM
    0.9 kB
    Eric Normand
  3. sourcemaps.patch
    11/Oct/13 11:26 AM
    0.5 kB
    Eric Normand

Activity

Hide
Julien Eluard added a comment -

I can confirm sourcemaps location are now correctly generated and both Firefox and Chrome Canary (latest) correctly load them.

Note that I now get a bunch of:
"WARNING: No such namespace: dommy.template at line 36 /Users/julien/Documents/Projects/lucuma/examples/target/cljsbuild-compiler-0/dommy/attrs.cljs"

It's not clear to me if it's related to this patch or not. I do get with latest master (1932) + the patch but not with 1913.

Show
Julien Eluard added a comment - I can confirm sourcemaps location are now correctly generated and both Firefox and Chrome Canary (latest) correctly load them. Note that I now get a bunch of: "WARNING: No such namespace: dommy.template at line 36 /Users/julien/Documents/Projects/lucuma/examples/target/cljsbuild-compiler-0/dommy/attrs.cljs" It's not clear to me if it's related to this patch or not. I do get with latest master (1932) + the patch but not with 1913.
Hide
David Nolen added a comment -

Thanks for the report. I fixed the spurious namespace errors and I'm pushing another release.

Show
David Nolen added a comment - Thanks for the report. I fixed the spurious namespace errors and I'm pushing another release.
Hide
Julien Eluard added a comment -

I don't have those warnings anymore with 1934. The patch looks good then!

As a side note, I now have this WARNING:
WARNING: No such namespace: cljs.core.PersistentQueue at line 524 /Users/julien/Documents/Projects/lucuma/examples/target/cljsbuild-compiler-0/cljs/reader.cljs

Offending line is: cljs.core.PersistentQueue/EMPTY
Looks like a leftover from the "bad namespace convention" changes you did recently?

Show
Julien Eluard added a comment - I don't have those warnings anymore with 1934. The patch looks good then! As a side note, I now have this WARNING: WARNING: No such namespace: cljs.core.PersistentQueue at line 524 /Users/julien/Documents/Projects/lucuma/examples/target/cljsbuild-compiler-0/cljs/reader.cljs Offending line is: cljs.core.PersistentQueue/EMPTY Looks like a leftover from the "bad namespace convention" changes you did recently?
Hide
David Nolen added a comment -

You have stale code lying around. Clean your build.

Show
David Nolen added a comment - You have stale code lying around. Clean your build.
Hide
Julien Eluard added a comment -

I think it comes from this line ? Changing it to cljs.core.PersistentQueue.EMPTY removes the warning.

Show
Julien Eluard added a comment - I think it comes from this line ? Changing it to cljs.core.PersistentQueue.EMPTY removes the warning.
Hide
David Nolen added a comment -

Oh we missed a case, thanks and fixed in master.

Show
David Nolen added a comment - Oh we missed a case, thanks and fixed in master.
Hide
Eric Normand added a comment -

This is an updated patch that includes only 2 lines of change. (No API Changes)

Show
Eric Normand added a comment - This is an updated patch that includes only 2 lines of change. (No API Changes)
Eric Normand made changes -
Field Original Value New Value
Attachment sourcemaps.patch [ 12313 ]
Hide
Eric Normand added a comment -

This patch should be good with git am

Show
Eric Normand added a comment - This patch should be good with git am
Eric Normand made changes -
Attachment source-map2.patch [ 12314 ]
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: