I try to scripting using new cljs.main tool
deps.edn
:
{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}
:aliases
{:cljs {:main-opts ["-m" "cljs.main" "-re" "node"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.238"}}}}}
test.cljs
(require 'fs)
(println (fs/readFileSync "README.md" "utf8"))
When running with cmd: clj -A:cljs test.cljs
it throws exception:
Exception in thread "main" clojure.lang.ExceptionInfo: No such namespace: fs, could not locate fs.cljs, fs.cljc, or JavaScript source providing "fs" at line 1 test.cljs..
But when I try with other node module, e.g. install left-pad
& test with code bellow, it just work fine.
(require 'left-pad)
(println (left-pad "foo" 5))
So I’m not sure what’s thing I miss here?
**update: run 2 scripts above on cljs REPL directly & it work fine. So I don’t know what’s issue with clj -A:cljs test.cljs
cmd