Fork me on GitHub
#shadow-cljs
<
2020-03-17
>
hindol06:03:25

Hi, on http://shadow-cljs.org I see None-code resources. Should this be Non-code resources? Wondering if this is a typo.

thheller07:03:35

@davewo the cache includes the last-modified timestamps of the source files so if those change it will invalidate the cache. they probably change between CI builds right?

davewo18:03:59

Most likely. So file content does not factor into cache invalidation, then?

thheller19:03:50

currently only timestamp

thheller07:03:21

@hindol.adhya not actually sure. I am German. maybe?

hindol07:03:27

Think that's a typo then. "Non-code resources" is correct English for "resources that are not code".

Ben Hammond10:03:51

Is the DOM available to code that is called using :after-load hook? it is unreasonable to expect

(.getElementById js/document "app")
to be mountable?

Ben Hammond10:03:49

ah I see my misconception; DOM gets built upon page refresh :after-load gets called upon recompilation

thheller11:03:12

no, your conception is wrong

thheller11:03:45

:after-load gets called AFTER the recompiled code has been loaded

thheller11:03:58

YOU trigger the DOM refresh you want to do in after load

thheller11:03:10

shadow-cljs does nothing to the DOM, only your code does

thheller11:03:39

and yes the "app" element is available unless you removed it from the dom yourself

Ben Hammond10:03:31

my restated question is: I configure schema-cljs.edn with my app module thus

:modules
        {:main {:entries []}}
and I have to fire up the app from with index.html like this
<div id="app"></div>
    <script src="js/main.js"></script>
    <script>my.app.main();</script>
and I'm complaining about having to repeat the classname of my app in two places: index.html and schema-cljs.edn but I supppose this is necessary because schema-cljs.edn goes away at release time but the app's main function will still have to get called

Ben Hammond10:03:55

is that right? or is there a smarter way to do things?

tvaughan11:03:17

:entries is for the google closure compiler and the tree shaking that it does. You probably want to add :init-fn

thheller11:03:01

@ben.hammond instead of entries use {:init-fn }. then you can remove the second script tag that calls the main

👍 4
Chris McCormick12:03:02

am i going crazy or was there a way to slurp a text file into a variable at compile time at some point using shadow-cljs?

Chris McCormick12:03:19

looking through the user guide but i can't figure out what to search on

Chris McCormick12:03:01

thank you so much 🙏

p-himik16:03:12

In the shadow-cljs repo, why are there both project.clj and deps.edn? Was just nosing around after dnolen mentioned that CLJS 1.10.597 has a regression that leads to an increased bundle size and noticed that project.cljs has 1.10.597 while deps.edn has 1.10.520, which doesn't have the regression.

thheller17:03:54

@p-himik I tested deps.edn but it is not used and not compatible

👍 4
thheller17:03:04

there are .java sources that need to be compiled

aisamu19:03:13

Hi! After adding day8.re-frame/http-fx {:mvn/version "v0.2.0"} to our project, it started failing on release builds with:

IllegalStateException: Could not find where to put constant cljs$cst$keyword$method. Used by [ajax.simple.js, ajax.xhrio.js, ajax.easy.js, sablono.core.js, ajax.interceptors.js, company.namespace.events.js, ajax.xml_http_request.js], selected common dep goog.structs.map.js
There's a reference to a similar issue on https://clojurians-log.clojureverse.org/shadow-cljs/2019-01-09, but we don't use :modules. What'd be the next thing to investigate?

aisamu19:03:52

The build config is pretty straightforward:

{:target :npm-module
 :output-dir "build/cljs"
 :compiler-options {:infer-externs :auto
                    :source-map true}}

aisamu20:03:34

Using an aliased require appears to have fixed it (e.g. [ajax.edn :as edn] instead of just [ajax.edn]) :man-shrugging:

thheller20:03:24

:npm-module basically creates on :module per namespace. so you are definitely using :modules. I can't really remember the details from this previously. If you have something reproducible I can look at I can investigate further

👌 4
aisamu18:03:38

I tried coming up with a repro repo, but the commit that failed yesterday works today 😞. The parallel build order might be affecting it

aisamu19:03:01

Observed on two different projects, (running shadow .68 and .93)

frozar21:03:22

@thheller Hi, I daily use shadow-cljs ❤️ and it seems to have a minor security issue due to its dependencies to minimist :

thheller22:03:09

please open a github issue. don't have time to look into that right now and it'll get lost in slack void

sogaiu21:03:27

i think that might have to do with mocha

sogaiu21:03:51

being the one that eventually pulls in minimist

sogaiu21:03:02

nm, nice path there :)