                                    caches)))))]
     (fn [next-handler]
       (fn [fileset]
-        (let [opts (clj->js (concat ["-c"
-                                     (str/join ":" (concat source-paths (:classpath fileset)))]
-                                    opts))]
+        (let [repl (let [idx (inc (.indexOf opts "-n"))]
+                     (when (pos? idx)
+                       (let [[host port] (str/split (nth opts idx) #":")]
+                         {:host host :port (js/parseInt port)})))
+              opts (clj->js (concat
+                             (when (and (not repl) (some #{reload} (:tasks fileset)))
+                               ["-n" "127.0.0.1:5555"])
+                             ["-c" (str/join ":" (concat source-paths (:classpath fileset)))]
+                             opts))]
           (invalid-cache!)
           (some-> @process .kill)
           (reset! process
                   (js/child_process.spawn "lumo" opts #js {:stdio "inherit"}))
-          (next-handler (assoc fileset :invalid-cache! invalid-cache!)))))))
+          (next-handler (assoc fileset
+                               :lumo/invalid-cache! invalid-cache!
+                               :lumo/repl (merge {:host "127.0.0.1" :port 5555} repl))))))))
 
 (defn ^:export watch [t file]
   (fn [next-handler]

      (str/replace #"_" "-")
      symbol))

(defn ^:export reload [host port]
  (fn [next-handler]
    (let [conn (atom nil)]
      (fn reload* [fileset]
        (if-let [conn @conn]
          (when-let [file (:reload fileset)]
            ((:invalid-cache! fileset))
            (.send conn
                   (str (pr-str `(require '~(file->ns file) :reload))
                        \newline)

            (doto c
              (.on "ready" (fn [prompt]
                             (reset! conn c)
                             (reload* fileset)))
              (.on "data" #(print (str %)))
              (.on "error" (fn [prompt]
                             (js/setTimeout #(reload* fileset) 500)))
              (.connect #js {:host        (:host repl)
                             :port        (:port repl)
                             :shellPrompt "cljs.user=> "
                             :timeout     1500}))))))))

