<< Back to previous view

[CLJS-591] Source map string in JS output is not relative to JS file Created: 16/Sep/13  Updated: 11/Oct/13  Resolved: 11/Oct/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Eric Normand Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File clojurescript-source-map.patch     Text File source-map2.patch     Text File sourcemaps.patch    
Patch: Code


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.

Comment by Julien Eluard [ 10/Oct/13 12:55 PM ]

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.

Comment by David Nolen [ 11/Oct/13 7:49 AM ]

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

Comment by Julien Eluard [ 11/Oct/13 8:41 AM ]

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?

Comment by David Nolen [ 11/Oct/13 8:50 AM ]

You have stale code lying around. Clean your build.

Comment by Julien Eluard [ 11/Oct/13 9:09 AM ]

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

Comment by David Nolen [ 11/Oct/13 10:47 AM ]

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

Comment by Eric Normand [ 11/Oct/13 11:26 AM ]

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

Comment by Eric Normand [ 11/Oct/13 11:36 AM ]

This patch should be good with git am

Comment by David Nolen [ 11/Oct/13 11:51 AM ]

fixed, http://github.com/clojure/clojurescript/commit/e34fddfb181ee79de017e01d808401b3e2fc7e8d

Generated at Thu Jan 18 12:26:14 CST 2018 using JIRA 4.4#649-r158309.