             :core      {:output-to \"<tmp-dir>/js/main/core.js\" ...}}"
   [{:keys [tmp-out main] :as ctx}]
   (if-let [modules (:modules main)]
-    (assoc-in ctx [:opts :modules] (assoc (into {} (map (fn [[k v]]
-                                                          (let [js-path (util/path tmp-out (cljs-edn-path->module-path (:rel-path main) k))]
-                                                            [k (assoc v :output-to js-path)]))
-                                                        modules))
-                                          :cljs-base {:output-to (:output-to (:opts ctx))}))
+    (set-option ctx :modules (assoc (into {} (map (fn [[k v]]
+                                                    (let [js-path (util/path tmp-out (cljs-edn-path->module-path (:rel-path main) k))]
+                                                      [k (assoc v :output-to js-path)]))
+                                                  modules))
+                                    :cljs-base {:output-to (:output-to (:opts ctx))}))
     ctx))
 
 (defn source-map

                          compiler-options
                          (:compiler-options main))))

(defn main
  "Middleware to create the CLJS namespace for the build's .cljs.edn file and
  set the compiler :output-to option accordingly. The :output-to will be derived

        (spit (format-ns-forms (main-ns-forms cljs-ns init-nss init-fns)))))
    (-> ctx
        (update-in [:opts :asset-path] #(if % % asset-path))
        (set-option :output-dir out-path)
        (set-option :output-to js-path)
        (set-option :main main))))

(defn modules
  "If .cljs.edn file contains modules declaration, use it to create options
