shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
janezj 2021-01-13T19:02:21.478100Z

Hi, I am porting an old app created at the end of 2015. It was my first app in clojurescript, and since then in production. So from lighttable, leiningen, closure library I would like to migrate to calva, shadow-cljs, newer closure library. So far I am able to compile the code, and clj-kondo revealed some very fishy spots. But application works in simple mode. So now I would like to eliminate compilation warnings I am including google maps in my html page (<script src="https://maps.googleapis.com/maps/api/js?key=AIza.....&amp;libraries=drawing"></script>

34 | (when bslayer
  35 |   (google.maps.event/addListener
----------^---------------------------------------------------------------------
 No such namespace: google.maps.event, could not locate google/maps/event.cljs, google/maps/event.cljc, or JavaScript source providing "google.maps.event"
my build:
{:frontend
  {:target :browser
   :compiler-options {:externs ["google_maps_api_v3_19.js"]}
; google_maps_api_v3_19.js is in the same dir as shadow-cljs.edn

thheller 2021-01-13T19:12:50.478600Z

@jj974 use js/google.maps.events.addListener

thheller 2021-01-13T19:13:08.479Z

if you use google.maps.event/addListener it expects that to be a CLJS namespace

janezj 2021-01-13T19:32:02.486200Z

Thanks, I was looking (reading about) npm stuff. this is much better.

grav 2021-01-13T20:40:37.486500Z

:node-test ❤️

grav 2021-01-13T20:50:39.488Z

In Cursive, I'm happily using a Remote Repl with Shadow. I normally run npx shadow-cljs watch app from the terminal, however. Any good hints on how to integrate this part of the workflow better into Intellij?

thheller 2021-01-13T20:54:55.488200Z

Cursive does have a built-in terminal? 😛

Felipe Marques 2021-01-13T22:05:26.489500Z

Hi guys! I'm connected to a CLJS Repl (running on the browser), with Shadow 2.11.13 and CLJS 1.10.773 and I keep getting this error when trying to eval my dev namesapce:

Execution error (ReferenceError) at (&lt;cljs repl&gt;:1).
dev is not defined
This also happens when I run part of it, like this:
(defn sumation [a b]
  (+ a b))
This appear to be a problem specially when I run a def or defn

grav 2021-01-13T22:07:03.489800Z

Oh yeah! That's actually working pretty well!

grav 2021-01-13T22:11:34.492Z

I've successfully created a node-library with Shadow, but my intention is to use the "module" in a Chrome extension (which doesn't consume modules). Should I just use Webpack on the side, or is there more sense in just using :target :browser, marking my api fns with ^:export?

thheller 2021-01-13T22:56:52.492300Z

what is a "module" in a chrome extension?

thheller 2021-01-13T22:57:09.492600Z

there is a dedicated :chrome-extension target

👍 1
grav 2021-01-13T23:08:48.493200Z

Oh - didn't see that in the docs - thanks 🙂

thheller 2021-01-13T23:50:47.493600Z

its not in the docs yet. kinda unfinished but works ok

👍 1
thheller 2021-01-13T23:51:11.493800Z

https://github.com/thheller/shadow-cljs/issues/279