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

0 votes
in ClojureScript by

There is a failure to process {{(require 'cljs.js)}} when in an {{--init}} file for the browser REPL. I haven't found any other namespace that this fails with (for example, {{clojure.set}} doesn't exhibit this).

Repro:

`
(require 'cljs.js)

(prn cljs.js/empty-state)
`

$ clj -Srepro -m cljs.main -re browser -i foo.cljs -r TypeError: undefined is not an object (evaluating 'cljs.js.empty_state') cljs.user=>

It works fine with Node:

`
$ clj -Srepro -m cljs.main -re node -i foo.cljs -r

object[cljs$js$empty_state]

cljs.user=>
`

2 Answers

0 votes
by

Comment made by: mfikes

Workaround:

Add an explicit {{-e}} with {{require}} prior to the {{-i}}:

clj -Srepro -m cljs.main -re browser -e "(require 'cljs.js)" -i foo.cljs -r

This is an odd workaround because, if you use it, you still need the require in the {{foo.cljs}} file.

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