This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-01
Channels
- # announcements (2)
- # babashka (93)
- # beginners (57)
- # biff (3)
- # cider (7)
- # clerk (5)
- # clj-kondo (9)
- # clojure (26)
- # clojure-austin (1)
- # clojure-bay-area (5)
- # clojure-europe (13)
- # clojure-norway (88)
- # clojure-uk (7)
- # clojurescript (3)
- # cursive (4)
- # datahike (2)
- # datalevin (10)
- # datomic (1)
- # events (4)
- # hyperfiddle (5)
- # jobs (3)
- # lsp (1)
- # malli (4)
- # missionary (3)
- # nrepl (1)
- # off-topic (45)
- # overtone (4)
- # pedestal (4)
- # polylith (13)
- # reitit (15)
- # releases (2)
- # shadow-cljs (30)
- # squint (1)
- # vim (1)
- # xtdb (6)
Another dependency issue (I read the docs this time). To reproduce:
$ lein new re-frame re-frame-test
$ cd re-frame-test
$ npm install
$ npm install react-datepicker
Use dependency:
(ns re-frame-test.views
(:require
[re-frame.core :as re-frame]
[re-frame-test.subs :as subs]
["react-datepicker" :refer (DatePicker)]
))
(defn main-panel []
(let [name (re-frame/subscribe [::subs/name])]
[:div
[:h1
"Hello from " @name]
[DatePicker]]))
Build completes, but browser console gives:
template.cljs:277 Uncaught Error: Assert failed: Invalid Hiccup form: [nil]
(in re_frame_test.views.main_panel)
(valid-tag? tag)
at Object.reagent$impl$template$vec_to_elem [as vec_to_elem] (template.cljs:277:5)
at Object.reagent$impl$template$as_element [as as_element] (template.cljs:294:22)
at Object.eval [as reagent$impl$protocols$Compiler$as_element$arity$2] (template.cljs:315:10)
at Object.reagent$impl$protocols$as_element [as as_element] (protocols.cljs:6:16)
at eval (template.cljs:140:37)
at eval (core.cljs:5704:36)
at eval (core.cljs:5704:35)
at Object.eval [as cljs$core$IKVReduce$_kv_reduce$arity$3] (core.cljs:5708:24)
at Object.cljs$core$_kv_reduce [as _kv_reduce] (core.cljs:715:16)
at Object.cljs$core$reduce_kv [as reduce_kv] (core.cljs:2596:8)
Am I doing something wrong? Thank youseems like a reagent issue caused by an import issue, evaluate DatePicker
in your re-frame-test.views
namespace
I am 99% sure it is evaluating to nil
, so you need to figure out how react-datepicker
is exporting symbols
and you'll find that it should be ["react-datepicker$default" :as DatePicker]
, or depending on how the package is actually distributed it might actually be ["react-datepicker" :as DatePicker]
. the docs cover how to figure that out
Thanks I appreciate it
Not seen this one before, trying to import ["@triplit/client" :refer [TriplitClient]]
throws with
[:app] Build failure:
package export match referenced a file that doesn't exist
{:rel-require "./", :package-dir #object[java.io.File 0x7e7c2b2d "./node_modules/@triplit/db"], :match {"types" "./dist/types/index.d.ts", "require" "./dist/cjs/index.js", "import" "./dist/esm/index.js", "default" "./dist/esm/index.js"}, :exports {"." {"types" "./dist/types/index.d.ts", "require" "./dist/cjs/index.js", "import" "./dist/esm/index.js", "default" "./dist/esm/index.js"}}}
though there is definitely a ./dist/esm/index.js file in ./node_modules/@triplit/db
I'm on the latest shadow-cljs so I believe the exports syntax is supported now, but maybe not? or maybe I need to configure something different in my edn?
{:app {:target :browser
:js-options {:entry-keys ["module" "browser" "main"]}
:compiler-options {:output-feature-set :es-next}
:output-dir "../src/cljs"}}
the default path taken there is "require"
and that file does not exist as far as I can tell
that works but now I get
[:app] Compiling ...
[:app] Build failure:
Closure compilation failed with 3 errors
--- node_modules/@triplit/db/dist/esm/db-transaction.js:44
Transpilation of 'Member references this or super' is not yet implemented.
--- node_modules/@triplit/db/dist/esm/db-transaction.js:58
Transpilation of 'Member references this or super' is not yet implemented.
--- node_modules/@triplit/db/dist/esm/db-transaction.js:87
Transpilation of 'Member references this or super' is not yet implemented.
😢it works in normal js land so not technically broken, though why people insist on reinventing the wheel with this package.json stuff is beyond me
yeah I'm not using it for anything serious, just want to play... but i think I have to accept that any new js library has some curse which enforces the authors to use the newest syntax possible and therefore won't work with cljs
I did get shadow to find the files using your export-conditions thing but now stuck at Transpilation of 'Member references this or super' is not yet implemented.
which I guess is just another closure limitation
actually got it to work with com.google.javascript/closure-compiler-unshaded "v20230802"
I guess I run some tests tomorrow to ensure its safe to upgrade and bump it in shadow-cljs directly
That would be cool thanks, and if they finally get around to fixing the new private class fields syntax (supported by all browsers since 2021) then that fixes 99% of issues I have with closure