ClojureScript

cljs.main: Browser REPL failure processing require of cljs.js in --init file

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:

Description

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:

foo.cljs
(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=>

Activity

Hide
Mike Fikes added a comment -

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.

Show
Mike Fikes added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: