Skip to content

Commit

Permalink
CLJS-1772: Dependency index can incorrectly overwrite .cljs files w…
Browse files Browse the repository at this point in the history
…ith `.cljc` files if both are present
  • Loading branch information
anmonteiro authored and swannodette committed Sep 3, 2016
1 parent ddf1836 commit ce6c657
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/clojure/cljs/js_deps.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,18 @@ case."
(fn [index' provide]
(if (:foreign dep)
(update-in index' [provide] merge dep)
(assoc index' provide dep)))
;; when building the dependency index, we need to
;; avoid overwriting a CLJS dep with a CLJC dep of
;; the same namespace - António Monteiro
(let [file (when-let [f (or (:source-file dep) (:file dep))]
(.toString f))
ext (when file
(.substring file (inc (.lastIndexOf file "."))))]
(update-in index' [provide]
(fn [d]
(if (and (= ext "cljc") (some? d))
d
dep))))))
index provides)
index)]
(if (:foreign dep)
Expand Down

0 comments on commit ce6c657

Please sign in to comment.