shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
valerauko 2021-03-29T11:12:16.214600Z

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

thheller 2021-03-29T11:36:47.215200Z

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

👍 1
thheller 2021-03-29T11:38:48.216200Z

just using deno not node specific stuff

thheller 2021-03-29T11:45:49.217Z

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

thheller 2021-03-29T11:47:31.218Z

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

simongray 2021-03-29T12:06:12.220900Z

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]
            [<http://clojure.java.io|clojure.java.io> :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)

simongray 2021-03-29T12:07:20.222600Z

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.

thheller 2021-03-29T12:07:47.223100Z

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

thheller 2021-03-29T12:08:23.223800Z

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

✔️ 1
simongray 2021-03-29T12:09:04.224200Z

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