Fork me on GitHub
#shadow-cljs
<
2021-01-13
>
janezj19:01:21

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

thheller19:01:50

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

thheller19:01:08

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

janezj19:01:02

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

grav20:01:37

:node-test ❤️

grav20:01:39

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?

aratare02:01:36

You can have a run configuration to run npm run. It's what I'm using at the moment.

thheller20:01:55

Cursive does have a built-in terminal? 😛

grav22:01:03

Oh yeah! That's actually working pretty well!

Felipe Marques22:01:26

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 (<cljs repl>: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

grav22:01:34

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?

thheller22:01:52

what is a "module" in a chrome extension?

thheller22:01:09

there is a dedicated :chrome-extension target

👍 3
grav23:01:48

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

thheller23:01:47

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

👍 3