Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
{code:title=src/foo/core.cljs}
(ns foo.core
  (:require left-pad))

(defn pad [n]
  (left-pad n 10 0))


We pass {{-d}} here to work around CLJS-2752 and CLJS-2666.


$ clj -m cljs.main -co '{:npm-deps {:left-pad "1.3.0"} :install-deps true}' -d out -r
cljs.user=> (load-file "foo/core.cljs")
nil
cljs.user=> (dir foo.core)
pad
nil
cljs.user=> (foo.core/pad 3)
ReferenceError: Can't find variable: foo
cljs.user=> (require 'foo.core)

cljs.user=> (foo.core/pad 3)
"0000000003"


Note that {{load-file}} fails (even though it can succeed; see CLJS-2753), while {{require}} succeeds.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2774 (reported by mfikes)
...