Skip to content

Commit 9e0a84e

Browse files
committed
remove copying over :output-to in cljs.cli for browser repl,
this kind of customization is just not necessary, user can provide their own index page if they're going to change :output-to away from :output-dir/main.js
1 parent 7af2ff6 commit 9e0a84e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/clojure/cljs/cli.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ present"
317317
(assoc :output-dir (temp-out-dir) :temp-output-dir? true)
318318
(not (contains? options :aot-cache))
319319
(assoc :aot-cache true))
320-
reopts (merge repl-env-options (select-keys opts [:output-to :output-dir]))
320+
reopts (merge repl-env-options (select-keys opts [:output-dir]))
321321
_ (when (or ana/*verbose* (:verbose opts))
322322
(util/debug-prn "REPL env options:" (pr-str reopts)))
323323
renv (apply repl-env (mapcat identity reopts))]

src/main/clojure/cljs/repl/browser.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,7 @@
177177

178178
(defn send-static
179179
[{path :path :as request} conn
180-
;; NOTE: :output-to and :output-dir are available here because cljs.cli
181-
;; does this - should maybe rethink that, we need a better way to supply
182-
;; the main JS file to load because it might not be compiler options :output-to
183-
;; i.e. bundler step
184-
{:keys [static-dir output-to output-dir host port gzip?] :or {output-dir "out"} :as opts}]
180+
{:keys [static-dir output-dir host port gzip?] :or {output-dir "out"} :as opts}]
185181
(let [output-dir (when-not (.isAbsolute (io/file output-dir)) output-dir)]
186182
(if (and static-dir (not= "/favicon.ico" path))
187183
(let [path (if (= "/" path) "/index.html" path)
@@ -208,11 +204,14 @@
208204
encoding (mime-type->encoding mime-type "UTF-8")]
209205
(server/send-and-close conn 200 (slurp local-path :encoding encoding)
210206
mime-type encoding (and gzip? (= "text/javascript" mime-type))))
207+
211208
;; "/index.html" doesn't exist, provide our own
212209
(= path "/index.html")
213210
(server/send-and-close conn 200
214-
(default-index (or output-to (str output-dir "/main.js")))
211+
(default-index (str output-dir "/main.js"))
215212
"text/html" "UTF-8")
213+
214+
;; "/main.js" doesn't exist, provide our own
216215
(= path (cond->> "/main.js" output-dir (str "/" output-dir )))
217216
(let [closure-defines (-> `{"goog.json.USE_NATIVE_JSON" true
218217
clojure.browser.repl/HOST ~host
@@ -230,6 +229,7 @@
230229
"document.write('<script src=\"" output-dir "/brepl_deps.js\"></script>');\n"
231230
"document.write('<script>goog.require(\"clojure.browser.repl.preload\");</script>');\n")
232231
"text/javascript" "UTF-8"))
232+
233233
:else (server/send-404 conn path)))
234234
(server/send-404 conn path))))
235235

0 commit comments

Comments
 (0)