This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-02
Channels
- # announcements (2)
- # babashka (9)
- # calva (8)
- # cider (2)
- # clj-kondo (3)
- # clojure (113)
- # clojure-austin (1)
- # clojure-dev (27)
- # clojure-europe (11)
- # clojure-germany (2)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-uk (32)
- # clojuredesign-podcast (4)
- # core-async (16)
- # core-typed (45)
- # cursive (5)
- # data-science (1)
- # datomic (7)
- # events (1)
- # gratitude (2)
- # hugsql (1)
- # hyperfiddle (7)
- # integrant (4)
- # keechma (10)
- # leiningen (4)
- # malli (1)
- # missionary (14)
- # off-topic (62)
- # onyx (8)
- # other-languages (21)
- # pathom (1)
- # reitit (4)
- # releases (2)
- # shadow-cljs (35)
- # squint (1)
- # transit (1)
Hi folks! I'm trying to figure out what I'm doing wrong with ShadowCLJS. I'm getting a cryptic eval error with no stacktrace trying to compile a minimal ClojureScript file:
(ns ring.example.chat.client)
(defn on-load [_]
(js/console.log "Hello World"))
(defn init []
(.addEventListener js/window on-load))
With a shadow-cljs.edn that looks like:
{:deps true
:builds
{:client {:target :browser
:output-dir "target/assets/public/js"
:asset-path "/js"
:modules {:main {:init-fn ring.example.chat.client/init}}}}}
Does anyone happen to have any ideas what might be causing this? Without a stack trace or any further information on what the error actually is, I'm hitting a wall.
Edit: Found the issue! It was just a typo - I missed out the "load" event name on the event listener! And of course I notice that the moment I post! However, I would like to know if there's a way of getting more detail error messages? Like something that would tell me that there's a problem at a particular line, rather than just "there's an error somewhere". I've tried --debug
to turn on source mapping, but it doesn't appear to register in Firefox.How do I convert the following javascript code to clojurescript?
const origins = ["foo", "bar"];
sysend.proxy(...origins);
I tried using shadow-cljs (after npm i sysend
)
(ns core
(:require
[sysend])
(def origins = ["foo" "bar"]
(apply .proxy sysend origins)
but this fails during (advanced) compilation with (Parse error. ‘)’ expected), when I use sysend.proxy
there’s no error, but then the resulting web page does not work because sysend cannot be found