Skip to content

JS files are not compiled with cljsbuild 0.3.2 #203

Closed
pallix opened this Issue May 16, 2013 · 11 comments

4 participants

@pallix
pallix commented May 16, 2013

Hi,

I have this Clojure project using both JS and CLJS files:

https://github.com/carneades/carneades/tree/projectui/src/CarneadesWebApp

The JS files get compiled with lein-cljsbuild 0.3.0 but not with 0.3.2.

@emezeske
Owner

Is there any kind of error being emitted? How do you know they're not being compiled, exactly? Just by inspecting the JS output? It seems like this is probably a ClojureScript bug to me (although I can't be sure): http://dev.clojure.org/jira/browse/CLJS.

@pallix
pallix commented May 17, 2013

No error is displayed but I looked at the generated JS code and the functions are missing.

Also 0.3.1 does not work.

Do you have a suggestion on how I could try a different ClojureScript version or the same version of ClojureScript 0.3.0 to see it that would work? We could then know if the problem if from the lein plugin or from the ClojureScript.

@emezeske
Owner

This is a little tricky, unfortunately, because the newest version of the ClojureScript compiler uses Clojure 1.5.1 whereas the old version used Clojure 1.4.0. You could try [1] to use a checkout version of the ClojureScript compiler with the r1552 tag checked out, but I'm not sure if it will work with Clojure 1.5.1.

[1] https://github.com/clojure/clojurescript/tags

@swannodette

We need a minimal reproducible case to determine whether this is a lein-cljsbuild or ClojureScript issue. I'll be following along closely. Thanks all!

@pallix
pallix commented Jun 20, 2013

I have tried to build a minimal example with this project:

https://github.com/pallix/cljs-bug

However, now I even don't get the JS file to be compiled with lein-cljsbuild 0.3.0.

Not sure why? Maybe a problem with my configuration or maybe another bug.

@pallix
pallix commented Jun 20, 2013

There is a script/test_bug.sh script that will return a non-zero value if the test is failing.

@pallix
pallix commented Oct 30, 2013

So I updated lein-cljsbuild on the test project

https://github.com/pallix/cljs-bug

The JavaScript file still does not get compiled.

@cemerick
Collaborator
cemerick commented Nov 1, 2013

Saw your issue filed @ CLJS-649. Here's what you need to do:

  • hello.js contains google.provide('a.hello');. This needs to be goog.provide('a.hello');.
  • In your project.clj, you have two options:
    • Change :libs to ["src-js/libs/a/hello.js"] (so that the file is loaded directly from the filesystem), or
    • Add src-js/libs to your project classpath by adding a top-level entry to project.clj of e.g. :source-paths ["src" "src-cljs" "src-js"], and change :libs to [""], which will cause ClojureScript to search your entire classpath for javascript libs that contain goog.provide calls.

I'd recommend the second project.clj option above, since it's more general-purpose (i.e. it keeps you from having to enumerate all of your js libraries one-by-one).

Sorry for the delay in my looking at this closely, but it was David's comment on CLJS-649 that made me realize where you were going astray.

If you can confirm that the above works for you (and close this issue if so), that'd be great.

@swannodette

I don't think the fact that the ClojureScript compiler hunts around for Google Closure style files should be depended on, at least until we can sort out if there's a way simplify how we resolve JS source and include it in a build.

@cemerick
Collaborator
cemerick commented Nov 1, 2013

The relevant issue that would change how :libs works is here.

@pallix
pallix commented Nov 4, 2013

Thank you Chas to the help. I can confirm it is working on the example project.

However when renaming the the "a" directory to "a-b" and the goog.provide('a.hello') to goog.provide('a_b.hello') it won't work. I will open a separate ticket for that.

@pallix pallix closed this Nov 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.