Reputation: 5796
I've tried adding a dependency to my deps.edn:
{:deps {cljsjs/js-yaml {:mvn/version "3.3.1-0"}
...}
But I'm not able to call functions from that library.
In the REPL:
cljs.user=> (require '[cljsjs.js-yaml])
cljs.user=> js/safeLoad
Execution error (ReferenceError) at (<cljs repl>:1).
safeLoad is not defined
The instructions I found are for leinigen (project.clj). Do I need to do something special to get it working in deps.edn?
Upvotes: 0
Views: 262
Reputation: 1904
You need to do js/jsyaml.safeLoad and at the repl you need to use the function require
rather than the symbol used in a ns declaration.
bfabry@18723-bfabry /t/foo> plk
ClojureScript 1.10.520
cljs.user=> (require '[cljsjs.js-yaml])
nil
cljs.user=> (js/jsyaml.safeLoad "app:\n bar: baz\n")
#js {:app #js {:bar "baz"}}
cljs.user=>
the packages are namespaced using js objects of their own name.
Upvotes: 1