<< Back to previous view

[CLJS-618] Source map "sources" is not created correctly on windows Created: 13/Oct/13  Updated: 27/Oct/13  Resolved: 27/Oct/13

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

Type: Defect Priority: Minor
Reporter: Jacob Mortensen Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: sourcemap

Windows 7

Attachments: File fix-windows-sourcemap-path     Text File fix-win-path.patch    
Patch: Code


To reproduce on windows 7:

  • clone clojurescript
  • run cljsc test.clj '{:source-map "test.js.map"}' > test.js
    The generated source map "sources" field contains a path to core.js.

Expected: "sources" field should contain path to core.cljs, not core.js.

Problem (closure.clj):
compiled-cljs is a map from a string to JavaScriptFile record like so:

core.js" #cljs.closure.JavaScriptFile [...]

On windows:
for a file: (.getPath (io/file path)) => "c:\src\hacking\out\cljs\core.js"
for a url: (.getPath ^URL url) => "/c:/src/hacking/out/cljs/core.js"

To check if resulting source map should be merged with the source map of a compiled file, the code does a lookup in compiled-cljs by url path. This does not match on windows because of / vs \.

Convert to file by (.getPath (io/file path)) then the core.clj is picked up from compiled-cljs.

I have tested on windows 7 and linux.

Comment by David Nolen [ 24/Oct/13 9:07 AM ]

This patch no longer applies to master can we get a new one that does? Thanks!

Comment by Jacob Mortensen [ 24/Oct/13 11:03 PM ]

I have attached an updated patch (fix-win-path.patch).

I did run into an error when I added :source-map to options (related to source maps), but the compiler did output a source map file that looks ok on windows.
I will take a look at the error I am seeing.

Comment by Jacob Mortensen [ 27/Oct/13 12:58 PM ]

The error I had has been fixed and applied: http://dev.clojure.org/jira/browse/CLJS-637.

Generated at Tue Jan 16 01:45:52 CST 2018 using JIRA 4.4#649-r158309.