Fork me on GitHub
#cljs-dev
<
2022-06-07
>
lilactown16:06:13

I'm having issues with the cljs node REPL and an ESM lib. is there an issue tracking that already?

borkdude16:06:37

@lilactown shadow supports ESM with :target :esm - also if you're using Node.js + ESM you might be interested in #nbb - AFAIK the vanilla CLJS compiler doesn't support ESM on Node.js yet

borkdude16:06:56

@lilactown More to your question, there is an issue here: https://clojure.atlassian.net/browse/CLJS-3325

1
borkdude16:06:04

It would be rad if CLJS could support ESM regardless of target like shadow does

borkdude16:06:16

@lilactown Having said that you might be able to use dynamic import inside a non-ESM target

borkdude16:06:47

Hmm, not sure what this is:

$ clj -M:cljs -m cljs.main -re node
ClojureScript 1.11.54
cljs.user=> (def js-import (js/eval "(x) => { return import(x); }"))
#'cljs.user/js-import
cljs.user=> (.catch (js-import "fs") prn)
#object[Promise [object Promise]]
cljs.user=> #object[TypeError TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.]

dnolen17:06:52

no idea but probably nothing to do w/ ClojureScript