Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Document automatic libs/externs support for libraries #143

emezeske opened this Issue · 12 comments

6 participants


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?


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... :-)


@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.


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.


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


:+1: for docs


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



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

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:

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.


No replies in more than a year. Closing.

@cemerick cemerick closed this
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.