Fork me on GitHub
#shadow-cljs
<
2021-03-29
>
valerauko11:03:16

@thheller have you made any progress with :target :esm and watch ? is there anything I could help with in that direction?

thheller11:03:47

watch works fine but I assume you mean hot-reload? that is runtime dependent and not implemented for deno

👍 3
thheller11:03:48

just using deno not node specific stuff

thheller11:03:49

if you want to work on that you can do so by setting :target :custom :devools {:client-ns the.ns-you-work-on}} in your build config

thheller11:03:31

its not documented much but happy to answer questions. it is fairly low level code but pretty straightforward.

simongray12:03:12

Having some troubles with using clojure.data.csv in a macro. Been following the approach in this guide: https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html I have a load.clj :

(ns load
  (:require [clojure.data.csv :as csv]
            [ :as io]))

(defmacro timeline
  []
  (with-open [reader (io/reader (io/resource "timeline.csv"))]
    (doall (csv/read-csv reader :separator \;))))
and a load.cljs :
(ns load
  (:require-macros [load]))
but when I try to require and then use it from my user.cljs , e.g.,
(ns user
  (:require [load :as load]))

(def timeline-data
  (load/timeline))
I get an error which seems to be related to the amount of lines in the csv file (433)

simongray12:03:20

However, if I wrap replace the use of the macro with (macroexpand '(load/timeline)) then it works. I’m sure I’m just doing some n00b macro error here.

thheller12:03:47

be mindful of what that macro is returning. right now it is returning a sequence ala ([1 2 3] [3 4 5])

thheller12:03:23

so it will be executed as such when compiling, ending up as an actual function call. swap the doall with a vec and it should be ok

✔️ 3
simongray12:03:04

ahhhh. I knew it was something silly like that. Thanks! And thank you for the guide too.