5
votes

I'm having trouble with the Production Builds section the ClojureScript quickstart. Specifically, when I run: java -cp "cljs.jar;src" clojure.main release.clj I get a java exception:

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/dev2/Experiments/cljscript/hello_world/out/cljs/core.js, compiling:(C:\dev2\Experiments\cljscript\hello_world\release.clj:3:1)

I'm doing this on Windows, and I suspect that the google closure compiler doesn't like the windows-style path, specifically the colon. My release.clj is:

(require 'cljs.build.api)

(cljs.build.api/build "src"
{
    :output-to "out/main.js"
    :optimizations :advanced
})

(System/exit 0)

and I'm invoking it with: java -cp "cljs.jar;src" clojure.main release.clj. If I comment out the :optimizations line then the build succeeds.

My exact setup is here: https://github.com/PaulRobson/cljs-quickstart

1
Hey! It's not impossible that there are issues with ClojureScript on Windows, especially when using optimization modes other than :none or :advanced (which are most commonly used). Is there any chance you could create a minimal reproduction of your problem? Then someone could take a look and maybe identify an issue in your setup or reproduce a bug, should there be one. - Martin Klepsch
Also, the code in the example are not windows-style paths. Windows-style would use the backslash, ie out\main.js. - Jim
@MartinKlepsch - I've added a git repo to the question. - elRobbo
@Jim Thanks for that suggestion. I tried it and it didn't help. I think it's actually choking on the : when it builds the full path like /C:/dev2/etc - elRobbo
I hit this too. And I found that it is an open issue with Google's Clousure compiler https://github.com/google/closure-compiler/issues/2611 - Alvin Sim

1 Answers

5
votes

This is a known issue https://dev.clojure.org/jira/browse/CLJS-2401

A workaround involves using an output directory with a hyphen, as in

(require 'cljs.build.api)

(cljs.build.api/build "src"
{
    :output-to "out-foo/main.js"
    :optimizations :advanced
})

(System/exit 0)