 (defn- config-default-dirs [{:keys [options ::config ::build] :as cfg}]
   (cond-> cfg
     (nil? (:output-to options))
-    (assoc-in [:options :output-to] (default-output-to
-                                     (:target-dir config)
-                                     (:id build)))
+    (assoc-in [:options :output-to] (default-output-to cfg))
     (nil? (:output-dir options))
-    (assoc-in [:options :output-dir] (default-output-dir
-                                      (:target-dir config)
-                                      (:id build)))))
+    (assoc-in [:options :output-dir] (default-output-dir cfg))))
 
 (defn figure-default-asset-path [{:keys [figwheel-options options ::config ::build] :as cfg}]
-  (let [{:keys [output-dir]} options]
-    ;; TODO could discover the resource root if there is only one
-    ;; or if ONLY static file serving can probably do something with that
-    ;; as well
-    ;; UNTIL THEN if you have configured your static resources no default asset-path
-    (when-not (contains? (:ring-stack-options figwheel-options) :static)
-      (let [parts (fw-util/relativized-path-parts (or output-dir
-                                                      (default-output-dir
-                                                       (:target-dir config)
-                                                       (:id build))))]
-        (when-let [asset-path
-                   (->> parts
-                        (split-with (complement #{"public"}))
-                        last
-                        rest
-                        not-empty)]
-          (str (apply io/file asset-path)))))))
+
+  (if (= :nodejs (:target options))
+    (:output-dir options)
+    (let [{:keys [output-dir]} options]
+      ;; TODO could discover the resource root if there is only one
+      ;; or if ONLY static file serving can probably do something with that
+      ;; as well
+      ;; UNTIL THEN if you have configured your static resources no default asset-path
+      (when-not (contains? (:ring-stack-options figwheel-options) :static)
+        (let [parts (fw-util/relativized-path-parts (or output-dir
+                                                        (default-output-dir cfg)))]
+          (when-let [asset-path
+                     (->> parts
+                          (split-with (complement #{"public"}))
+                          last
+                          rest
+                          not-empty)]
+            (str (apply io/file asset-path))))))))
 
 ;; targets options
 (defn- config-default-asset-path [{:keys [options] :as cfg}]

;; Config
;; ----------------------------------------------------------------------------

(defn default-output-dir [target & [scope]]
  (->> (cond-> [(or target "target") "public" "cljs-out"]
         scope (conj scope))
       (apply io/file)
       (.getPath)))

(defn default-output-to [target & [scope]]
  (.getPath (io/file (or target "target") "public" "cljs-out"
                     (cond->> "main.js"
                       scope (str scope "-")))))

(defn extra-config-merge [a' b']
  (merge-with (fn [a b]

                           nil))
                    "target")]
          (fw-util/dir-on-classpath? target-dir))
        temp-dir (when-not (or (= :nodejs (:target (:options cfg)))
                               target-on-classpath?)
                   (let [tempf (java.io.File/createTempFile "figwheel" "repl")]
                     (.delete tempf)
                     (.mkdirs tempf)
