Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't build ClojureScript quickstart with optimizations

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

like image 225
elRobbo Avatar asked Nov 15 '17 06:11

elRobbo


1 Answers

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)
like image 197
Mike Fikes Avatar answered Jan 01 '23 10:01

Mike Fikes