Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Document automatic libs/externs support for libraries #143

emezeske opened this Issue Oct 13, 2012 · 12 comments


None yet
6 participants

emezeske commented Oct 13, 2012

We originally added this feature as an experiment, but I haven't heard any complaints about it so I think it's time to document its existence.

See Issue #95 for an explanation of the feature in question.

I tried to used this feature.
The externs.js does get included in the jar.
However, projects using a library built this way don't seem to use the externs.js file and will happily munge away every names.

Did I miss a step?


emezeske commented Jan 27, 2013

No, I don't think you missed a step -- that sounds weird. Could you post the output of jar tf <your-project.jar>, and maybe the project.clj files for the library and client projects? I am at a loss to explain the problem you're seeing, and I don't know specifically what I'm looking for, but maybe something will jump out at me.

When I have a chance, I will set up a little test bed and see if I can reproduce the problem myself.

Sure thing.
I've already made the necessary test environment here:

The html files are in "resources/public/cljs"
The test.html works as expected, but not the test-with-min.html (the avanced compilation one).

Here is the result of jar tf envision-cljs-0.1.7.jar:


The externs.js is indeed in there.

I hope I just forgot something really obvious... :-)

lynaghk commented Jan 28, 2013

@Frozenlock, it doesn't look like the externs are going into the library jar under /closure-js, which is where they need to be to get picked up automatically when client projects are compiled.

Yup, worked perfectly once I renamed the directory /closure-js instead of /externs.
Thank you very much!

Is using the project-name in the path necessary to avoid any collision?
I see you specified /closure-js/<project name>/externs, but it works even with only /closure-js.

lynaghk commented Jan 28, 2013

I'm not that familiar with the JAR spec, but in all of my projects I'm packaging externs.js files in /closure-js/ and haven't run into any problems.


emezeske commented Jan 28, 2013

Thanks guys. I will count this as a +1 for me getting the docs written... :)

trevor commented Mar 7, 2013

👍 for docs

Hi, I have a stupid question. Is the closure-js just the path name, or :source-paths in cljsbuild configuration?

trevor commented Mar 10, 2013


% grep "closure" project.clj
% ;: none
% grep "source-paths" project.clj
    :builds [{:source-paths ["src-cljs"]
% ls -d1 ./resources/closure-js/*

cemerick commented Nov 12, 2013

FYI, ClojureScript will be changing to automatically resolve "goog-style" JavaScript libraries (i.e. those that contain the necessary goog.provide and goog.require declarations) from the classpath: http://dev.clojure.org/jira/browse/CLJS-656.

It seems like this should subsume the libs portion of this change. I'd love to hear from any users of cljsbuild's closure-js/libs and closure-js/externs conventions about CLJS-656, and how relevant externs are to you from a library perspective, etc.


cemerick commented Dec 15, 2014

No replies in more than a year. Closing.

@cemerick cemerick closed this Dec 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment