This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-10
Channels
- # adventofcode (68)
- # babashka (6)
- # babashka-sci-dev (3)
- # beginners (11)
- # biff (8)
- # circleci (13)
- # clj-kondo (1)
- # clojure (17)
- # clojure-europe (9)
- # clojurescript (12)
- # core-async (17)
- # cursive (9)
- # data-science (1)
- # datomic (3)
- # emacs (10)
- # fulcro (4)
- # off-topic (3)
- # practicalli (1)
- # releases (3)
- # sql (1)
- # xtdb (30)
Hey!
I dont get how to use ClojureScript interop correctly.
Ive used npm install pocketbase --save`` to install the PocketBase SDK via NPM + Shadow-Cljs.
But when I now try to import and use the
PocketBase``-Class with
clojure
(ns writers-corner.utils.pocketbase
(:require ["pocketbase" :refer [PocketBase]]))
(def client (PocketBase. ""))
I get the error
TypeError: module$node_modules$pocketbase$dist$pocketbase_es_mjs.PocketBase is not a constructor``
Any idea how to fix this?Two things to try:
• Read https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages and see where you went wrong
• Log the value of PocketBase
and see whether it makes sense or not
Maybe there is something else at play (that es_mjs
looks suspicious) but I'd still try the above.