Fork me on GitHub
#shadow-cljs
<
2021-04-13
>
dvingo04:04:54

is there a way to apply preloads only to some modules and not all. I am trying to create a web-worker, but the preloads assume the main thread js environment is present and are resulting in an exception when the worker starts.

thheller06:04:46

@danvingo you can set :preloads per module yes. just {:modules {:main {:init-fn :preloads [foo.bar]}}}

dvingo12:04:57

Thanks! That worked, but these are dev-time only preloads, is there a way to include them only during dev and not a release? I tried nesting them under :dev but they aren't being included now:

{:modules {:main { :dev 
;; moving to here:
{:preloads [...]} }
          :worker{}}
:devtools          {:after-load         app.client.client-entry/refresh
                                          :http-port          8044
                                          :http-resource-root "public"
                                          :http-root          "resources/public"
;; moving from here
                                          :preloads           [com.fulcrologic.fulcro.inspect.preload
                                                               app.client.development-preload
                                                               com.fulcrologic.fulcro.inspect.dom-picker-preload]}}

grounded_sage12:04:39

I have been digging through old Clojurians messages and issues on Github related to connecting a repl to different runtime environments we need to deal with when doing Chrome extensions. Still unclear to me if this is possible... let alone how to do it. It seemed that @wilkerlucio mentioned that he had it working on background and devtool but not content-script. Though I have not been able to get any working. Wondering what the current state of this is and whether it is worth investing any more time in trying to get it working. Seems that there is a lot of nrepl and sourcemap related issues..

introom13:04:40

Using shadowcljs$aot version, constantly seeing this error:

[:mobile] Build completed. (203 files, 91 compiled, 0 warnings, 13.29s)
Exception in thread "async-dispatch-2" java.lang.IllegalArgumentException: No implementation of method: :close! of protocol: #'clojure.core.async.impl.protocols/Channel found for class: nil
        at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:583)
        at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:575)
        at clojure.core.async.impl.protocols$eval1077$fn__1078$G__1066__1083.invoke(protocols.clj:21)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:979)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:975)
        at clojure.core.async$ioc_alts_BANG_$fn__3907.invoke(async.clj:384)
        at clojure.core.async$do_alts$fn__3839$fn__3842.invoke(async.clj:253)
        at clojure.core.async.impl.channels.ManyToManyChannel$fn__1491.invoke(channels.clj:265)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)