Skip to content

Commit c00dee8

Browse files
kommenswannodette
authored andcommitted
CLJS-3222: Allow build targets using :target-fn to supply a bootstrap file
1 parent b3b4df3 commit c00dee8

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/clojure/cljs/closure.clj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,14 +2928,17 @@
29282928
(map str (keys top-level)))))))
29292929
opts))
29302930

2931-
(defn output-bootstrap [{:keys [target] :as opts}]
2932-
(when (and (#{:nodejs} target)
2933-
(not= (:optimizations opts) :whitespace))
2931+
(defn output-bootstrap [{:keys [target target-fn] :as opts}]
2932+
(when (or (and (#{:nodejs} target)
2933+
(not= (:optimizations opts) :whitespace))
2934+
target-fn)
29342935
(let [target-str (name target)
29352936
outfile (io/file (util/output-directory opts)
29362937
"goog" "bootstrap" (str target-str ".js"))]
2937-
(util/mkdirs outfile)
2938-
(spit outfile (slurp (io/resource (str "cljs/bootstrap_" target-str ".js")))))))
2938+
;; not all targets using :target-fn might provide a bootstrap file to include
2939+
(when-let [bootstrap-file (io/resource (str "cljs/bootstrap_" target-str ".js"))]
2940+
(util/mkdirs outfile)
2941+
(spit outfile (slurp bootstrap-file))))))
29392942

29402943
(defn compile-inputs
29412944
"Compile inputs and all of their transitive dependencies including JS modules,

0 commit comments

Comments
 (0)