Skip to content


Add support for :externs and :use-only-custom-externs options #8

wants to merge 1 commit into from

3 participants


No description provided.


Clojure only takes contributions through its own issue tracking system. Please see

Meanwhile, I also ran into this and submitted a similar patch: I thought io/resource threw an exception when I tried to apply it to a file, so I used io/file, but perhaps I was mistaken.


Great, thanks John. Hopefully we'll your patch merged sometime soon.


A patch for this was submitted a while back. I have created an externs branch and applied that patch. Please test these changes with whatever you are working on and let us know if you find problems. You may let us know in JIRA, or the Clojure dev mailing list. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/clj/cljs/closure.clj
14 src/clj/cljs/closure.clj
@@ -101,16 +101,14 @@
Options may contain an :externs key with a list of file paths to
load. The :use-only-custom-externs flag may be used to indicate that
- the default externs should be excluded.
- TODO: Implement options described above."
+ the default externs should be excluded."
- (let [default (CommandLineRunner/getDefaultExterns)]
+ (let [jsf #(js-source-file % (io/input-stream (io/resource %)))
+ default (if (:use-only-custom-externs opts) [] (vec (CommandLineRunner/getDefaultExterns)))
+ externs (if (:externs opts) (vec (concat default (map #(jsf %) (:externs opts)))) default)]
(if (= :nodejs (:target opts))
- (let [path "cljs/nodejs_externs.js"]
- (cons (js-source-file path (io/input-stream (io/resource path)))
- default))
- default)))
+ (conj externs (jsf "cljs/nodejs_externs.js"))
+ externs)))
(defn ^ make-closure-compiler []
(let [compiler (]
Something went wrong with that request. Please try again.