           es6-loader (ES6ModuleLoader. closure-compiler module-root)
           cjs (ProcessCommonJSModules. closure-compiler es6-loader)
           ^Node root (.parse closure-compiler source-file)]
+      (compile-if can-convert-amd?
+        (.process (TransformAMDToCJSModule. closure-compiler) nil root))
       (.process cjs nil root)
       (.toSource closure-compiler root))))
 

      (.getConstructor ES6ModuleLoader
        (into-array java.lang.Class
                    [AbstractCompiler java.lang.String])))
 (def can-convert-js-module? true)
 (def can-convert-js-module? false))

;; Closure API
;; ===========

(defmulti convert-js-module
  "Takes a JavaScript module and rewrites it into a Google Closure-compatible
  form. Returns the source of the new module as a single string."
  (fn [{module-type :module-type :as js}]
    (if (and (= module-type :amd) can-convert-amd?)
      ;; AMD modules are converted via CommonJS modules
      :commonjs
      module-type)))

(compile-if can-convert-commonjs?
  (defmethod convert-js-module :commonjs [js]
    (let [js-file (:file js)
          path (.getParent (io/file js-file))
