Skip to content

Commit 610ae65

Browse files
committed
CLJS-3242: Code Splitting Breakage
Address breaking API changes to Closure Library. Quick fix for the trusted resource URL problem, will need compiler changes for this to be done in a better way. Already loaded modules are marked differently now.
1 parent 917e1d2 commit 610ae65

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/cljs/cljs/loader.cljs

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
; You must not remove this notice, or any other, from this software
88

99
(ns cljs.loader
10-
(:require [goog.object :as gobj])
10+
(:require [goog.object :as gobj]
11+
[goog.html.legacyconversions :as legacy])
1112
(:import [goog.module ModuleLoader]
1213
[goog.module ModuleManager]))
1314

@@ -26,10 +27,14 @@
2627
(cond-> x
2728
(keyword? x) (-> name munge)))
2829

30+
(defn to-tr-url [x]
31+
(cond-> x
32+
(not (keyword? x)) legacy/trustedResourceUrlFromString))
33+
2934
(defn to-js [m]
3035
(reduce-kv
3136
(fn [ret k xs]
32-
(let [arr (into-array (map munge-kw xs))]
37+
(let [arr (into-array (map (comp munge-kw to-tr-url) xs))]
3338
(doto ret (gobj/set (-> k name munge) arr))))
3439
#js {} m))
3540

@@ -78,8 +83,8 @@
7883
(str "Module " module-name " does not exist"))
7984
(let [xs (deps-for module-name module-infos)]
8085
(doseq [x xs]
81-
(.setLoaded *module-manager* (munge-kw x)))
82-
(.setLoaded *module-manager* (munge-kw module-name))))
86+
(.setLoaded (.getModuleInfo *module-manager* (munge-kw x))))
87+
(.setLoaded (.getModuleInfo *module-manager* (munge-kw module-name)))))
8388

8489
(defn prefetch
8590
"Prefetch a module. module-name should be a keyword matching a :modules

0 commit comments

Comments
 (0)