        (if (seq deps)
          (let [dep (first deps)]
            (*load-fn* (ns->relpath dep)
-             (fn [source]
-               (if-not (nil? source)
-                 (analyze* bound-vars source opts
-                   (fn []
-                     (analyze-deps bound-vars ana-env lib (next deps) opts cb)))
+             (fn [resolved]
+               (if resolved
+                 (let [{:keys [lang source]} resolved]
+                   (condp = lang
+                     :clj (analyze* bound-vars source opts
+                            (fn []
+                              (analyze-deps bound-vars ana-env lib (next deps) opts cb)))
+                     :js  (analyze-deps bound-vars ana-env lib (next deps) opts cb)
+                     (throw
+                       (js/Error.
+                         (str "Invalid :lang specified " lang ", only :clj or :js allowed")))))
                  (throw
                    (ana/error ana-env
                      (ana/error-message :undeclared-ns

  Whatever function *load-fn* is bound to will be passed a munged relative
  library path (a string) and a callback. It is up to the implementor to
  orrectly resolve a .cljs, .cljc, or .js file (the order must be respected).
  The callback should be invoked with the source of the library (a string)."
    :dynamic true}
  *load-fn*
  (fn [name cb]

   (when-not (contains? @*loaded* name)
     (let [env (:*env* bound-vars)]
       (*load-fn* (ns->relpath name)
         (fn [resolved]
           (if resolved
             (let [{:keys [lang source]} resolved]
               (condp = lang
                 :clj (eval-str* bound-vars source opts
                        (fn [ret] (cb true)))
                 :js  (do
                        (*eval-fn* source)
                        (cb true))
                 (throw
                   (js/Error.
                     (str "Invalid :lang specified " lang ", only :clj or :js allowed")))))
             (throw
               (ana/error env
                 (ana/error-message :undeclared-ns
