shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
thheller 2020-11-13T10:50:56.012600Z

btw I missed this. you can set :js-options {:entry-keys ["module" "browser" "main"]} to make it use module by default. it isn't in the list by default since mixing commonjs and ESM is PITA. in the next release it'll use module last just in case neither browser or main are set.

thheller 2020-11-13T12:09:34.013100Z

did anyone upgrade to big sur yet? I'd be curious if this issue still exist in the final release. https://github.com/thheller/shadow-cljs/issues/767

rkiouak 2020-11-13T14:28:07.014300Z

apologies if theres an easy reachable answer to this (I wasn’t able to find it) — is there a way to reference an environment variable in the dev-http block of shadow-cljs.edn?

thheller 2020-11-13T14:29:03.015100Z

todo what exactly?

rkiouak 2020-11-13T14:29:05.015200Z

e.g. i want to be able to do something like:

{:nrepl    {:port 8777},
 :dev-http {8280 {:root             "resources/public",
                  :proxy-predicate  foo.bar/proxy-predicate,
                  :push-state/index "baz/index.html",
                  :proxy-url        (or (System/getenv "FOO_BAR_URL") "<https://bat.com/>")}},
...
}
 

thheller 2020-11-13T14:29:38.015800Z

#shadow/env ["FOO_BAR_URL" "<https://bat.com/>"] second value is default if env var is not set

rkiouak 2020-11-13T14:30:20.016700Z

ah, thank you… i did see that form in your docs, but i thought it had to occur in this block :closure-defines {http://your.app/URL #shadow/env "APP_URL"}`

rkiouak 2020-11-13T14:30:34.017100Z

foolish of me not to try, thanks for the help and love the tool!

thheller 2020-11-13T14:31:13.017600Z

yeah works everywhere. not specific to :closure-defines

jmckitrick 2020-11-13T17:14:32.018Z

So if I have cider connected to a shadow project and the repl is warning me `No available JS runtime.` yet jump-to-definition is working, what functionality will I be missing?

thheller 2020-11-13T17:29:08.019300Z

many cider operations don't actually require eval so they'll work. everything that does eval will need a runtime.

jmckitrick 2020-11-13T19:29:29.019600Z

Ah, ok. Turns out I figured out the issue. Gotta load the right page 🙂

cap10morgan 2020-11-13T20:31:33.020600Z

How can I use a local closure-compatible JS lib? Specifying :libs ["../path/to/lib"] and then requiring it as a namespace doesn't seem to work.

thheller 2020-11-13T20:32:04.021Z

just needs to be on the classpath normally

thheller 2020-11-13T20:32:23.021300Z

no extra option required afterwards

cap10morgan 2020-11-13T20:36:52.022300Z

With (:require ["sjcl/hmac" :as hmac]) I'm getting:

Execution error (AssertionError) at shadow.build.data/add-string-lookup (data.clj:119).
Assert failed: (symbol? sym)

thheller 2020-11-13T20:37:28.022700Z

hmm? whats the full stacktrace?

cap10morgan 2020-11-13T20:37:32.022900Z

and src/sjcl/hmac.js exists

thheller 2020-11-13T20:37:50.023200Z

this is a file with goog.provide?

cap10morgan 2020-11-13T20:37:55.023400Z

yes

thheller 2020-11-13T20:38:06.023700Z

then it should be (:require [sjcl.hmac :as hmac])

cap10morgan 2020-11-13T20:38:12.023900Z

ah ok

cap10morgan 2020-11-13T20:39:24.024200Z

does the FS path need to match the goog.provide value?

cap10morgan 2020-11-13T20:39:57.024800Z

i.e. goog.provide("foo.bar.baz") need to be in src/foo/bar/baz.js or similar?

thheller 2020-11-13T20:40:12.025100Z

ideally yes but it doesn't have to

cap10morgan 2020-11-13T20:41:31.025400Z

got it, thanks!

Ronny Li 2020-11-13T22:21:15.027Z

Hi everyone, I just stumbled on shadow.markup (https://github.com/thheller/shadow/wiki/shadow.markup) and thought it looked interesting but it hasn't been updated in 2 years. Is anyone here using it in production and would like to share their experience?