Fork me on GitHub
#shadow-cljs
<
2021-07-09
>
awb9904:07:50

I have a lazy loading question: I noticed that together with lazy loading of code I should b lazy loading of css. I know shadow does not deal with css. But it would be great to listen to module load events. So as soon as a module starts loading, I would like to load the associated css. Is this possible?

thheller06:07:53

@hoertlehner not with the built-in loader but you can easily wrap that to add your own css loading

awb9919:07:12

thanks @thheller your fast answers are incredibly helpful for me in using shadow-cljs. I really dont know how you find the time to provide such great support! thanks!

Justin Chandler14:07:36

Hey everyone! I'm trying to get the Puppeteer library to work with ClojureScript/ShadowCLJS and I'm getting this error when requiring it: Closure compilation failed with 1 errors --- node_modules/puppeteer/lib/cjs/puppeteer/common/AriaQueryHandler.js:33 Cannot convert ECMASCRIPT_2018 feature "RegExp named groups" to targeted output language Is there a way to configure the goog compiler to swap out the targeted output language to a later ecmascript and use the feature anyway through the shadow.edn or something or is there more to this kind of compatibility problem?

thheller16:07:53

@chandler.justin.s :compiler-options {:output-feature-set :es-next} in your build config

thheller16:07:56

not sure why you are getting this error though? are you trying to compile for the browser? puppeteer only works for node?

Justin Chandler16:07:58

@thheller Ahhh you're right, I did forget to change my target to Node! Hahaha I would've spent all day on that. Thank you, I appreciate it!

haywood16:07:47

when compiling a project that has uses a :bootstrap build I’m getting a lot of Uncaught ReferenceError: goog is not defined when the compiler is loaded in the application, I don’t get it during development and I’m not sure why… :thinking_face:

haywood16:07:55

My two builds:

{:app      {:target            :browser
             :output-dir        "target/cljsbuild/public/js"
             :asset-path        "/js"
             :module-hash-names true
             :modules           {:app {:entries []}}
             :compiler-options  {:warnings {:infer false}}
             :build-hooks
             [(scripts.gen-routes/watch)]
             :devtools
             {:watch-dir "resources/public"
              :preloads  [re-frisk-remote.preload
                          shadow.remote.runtime.cljs.browser]}
             :dev
             {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}}
             :js-options
             {:resolve {"dom-helpers/class/addClass"    {:target  :npm
                                                         :require "dom-helpers/addClass"}
                        "dom-helpers/class/removeClass" {:target  :npm
                                                         :require "dom-helpers/removeClass"}}}}
  :bootstrap {:target :bootstrap
              :output-dir "target/cljsbuild/public/js/bootstrap"
              :asset-path "/js/bootstrap"
              ;; These are the namespaces we expose to the bootstrapped compiler
              :entries [cljs.js
                        dlstats.telemetry.common
                        dlstats.telemetry.schema]
              :compiler-options
              {:warnings {:infer false}}

              ;; many macro namespaces can't be evaluated in ClojureScript -
              ;; so we exclude them here to avoid runtime errors. Note that
              ;; it's ok to include code that consumes Clojure (jvm) macros,
              ;; but only selfhost-compatible macros can be evaluated "live".
              :exclude #{cljs.js}}

haywood16:07:23

compiling with shadow-cljs release app bootstrap

thheller18:07:20

you must compile with :optimizations :simple in your app build :compiler-options

thheller18:07:06

the default :advanced does not work with self-hosted

2