         sources (if (= :whitespace (:optimizations opts))
                   (cons "var CLOSURE_NO_DEPS = true;" sources)
                   sources)
-        modules (build-modules sources (:modules opts))
+        modules (build-modules sources opts)
         ^List inputs (map (comp :closure-module second) modules)
         ^Result result (.compileModules closure-compiler externs inputs compiler-options)]
     (if (.success result)

             "\"); } else { console.warn(\"ClojureScript could not load :main, did you forget to specify :asset-path?\"); };</script>');\n")))))

(defn output-modules
  ([opts modules]
    (doseq [{:keys [output-to closure-module]} modules]
      (spit (io/file output-to) (.toSource ^JSModule closure-module)))))

(defn ^String rel-output-path
  "Given an IJavaScript which is either in memory, in a jar file,

                             (str ":source-map must name a file when using :whitespace, "
                                  ":simple, or :advanced optimizations"))
                           (doall (map #(source-on-disk all-opts %) js-sources)))
                         (if (:modules all-opts)
                           (->>
                             (apply optimize-modules all-opts js-sources)
                             (output-modules all-opts))
