       [:compiler-options :closure-defines 'shadow.cljs.devtools.client.env/server-host]
       (str server-addr))))
 
-(defn configure [state mode {:keys [build-id init-fn output-to] :as config}]
-  (let [output-file
-        (io/file output-to)
+(defn configure [state mode {:keys [build-id init-fn output-dir] :as config}]
+  (let [output-dir
+        (io/file output-dir)
+
+        output-file
+        (io/file output-dir "index.js")
 
         dev?
-        (= :dev mode)
+        (= :dev mode)]
 
-        output-dir
-        (if dev?
-          (io/file (.getParentFile output-file) "cljs-dev" (name build-id))
-          (io/file (.getParentFile output-file)))]
+    (io/make-parents output-file)
 
     (-> state
         (build-api/with-build-options {:output-dir output-dir})

  (s/keys
    :req-un
    [::init-fn
     ::shared/output-to]
    ))

(defmethod config/target-spec :react-native [_]

                '[cljs.user
                  shadow.cljs.devtools.client.react-native]))))))

(defn flush-dev-index [{::keys [output-file] :as state} {:keys [init-fn] :as config}]
  (spit output-file
    (str "var CLJS = require(\"./cljs_env.js\");\n"
         (->> (:build-sources state)
              (remove #{output/goog-base-id})
              (map #(data/get-source-by-id state %))
              (map :output-name)
              (map #(str "require(\"./" % "\");" ))
              (str/join "\n"))
         "\nCLJS." (cljs-comp/munge init-fn) "();")))

