ClojureScript

Node modules not usable from REPL without output-dir

Details

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

Description

I can use Node module from REPL if I define output-dir but not without:

❯ npm install @cljs-oss/module-deps left-pad

❯ java -jar cljs.jar -d out --repl
ClojureScript 1.10.145
cljs.user=> (require '[left-pad :as left-pad])
cljs.user=> (left-pad "foo" 5)
"  foo"

❯ java -jar cljs.jar
ClojureScript 1.10.145
cljs.user=> (require '[left-pad :as left-pad])
cljs.user=> (left-pad "foo" 5)
ReferenceError: module$home$juho$tmp$sdfsdf$node_modules$left_pad$index is not defined
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -6
    at java.lang.String.substring(String.java:1931)
    at clojure.core$subs.invokeStatic(core.clj:4926)
    at clojure.core$subs.invoke(core.clj:4921)
    at cljs.repl$file_display.invokeStatic(repl.cljc:384)
    at cljs.repl$file_display.invoke(repl.cljc:380)
    at cljs.repl$print_mapped_stacktrace$fn__6277.invoke(repl.cljc:397)
    at cljs.repl$print_mapped_stacktrace.invokeStatic(repl.cljc:394)
    at cljs.repl$print_mapped_stacktrace.invoke(repl.cljc:387)
    at cljs.repl$display_error.invokeStatic(repl.cljc:471)
    at cljs.repl$display_error.invoke(repl.cljc:451)
    at cljs.repl$repl_caught.invokeStatic(repl.cljc:797)
    at cljs.repl$repl_caught.invoke(repl.cljc:788)
    at cljs.repl$repl_STAR_$fn__6479$fn__6488.invoke(repl.cljc:996)
    at cljs.repl$repl_STAR_$fn__6479.invoke(repl.cljc:993)
    at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1285)
    at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1274)
    at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:953)
    at cljs.repl$repl_STAR_.invoke(repl.cljc:832)
    at cljs.cli$repl_opt.invokeStatic(cli.clj:258)
    at cljs.cli$repl_opt.invoke(cli.clj:247)
    at cljs.cli$main.invokeStatic(cli.clj:577)
    at cljs.cli$main.doInvoke(cli.clj:564)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invokeStatic(core.clj:659)
    at clojure.core$apply.invoke(core.clj:652)
    at cljs.main$_main.invokeStatic(main.clj:61)
    at cljs.main$_main.doInvoke(main.clj:52)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.lang.Var.applyTo(Var.java:702)
    at clojure.core$apply.invokeStatic(core.clj:657)
    at clojure.main$main_opt.invokeStatic(main.clj:317)
    at clojure.main$main_opt.invoke(main.clj:313)
    at clojure.main$main.invokeStatic(main.clj:424)
    at clojure.main$main.doInvoke(main.clj:387)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:702)
    at clojure.main.main(main.java:37)

Activity

Hide
Garrett Hopper added a comment -

I've also run into this issue

Fails
clj -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.339\"}}}" -m cljs.main -co "{:npm-deps {left-pad \"1.3.0\"} :install-deps true}" -r
Works with `-d out`
clj -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.339\"}}}" -m cljs.main -co "{:npm-deps {left-pad \"1.3.0\"} :install-deps true}" -d out -r
Show
Garrett Hopper added a comment - I've also run into this issue
Fails
clj -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.339\"}}}" -m cljs.main -co "{:npm-deps {left-pad \"1.3.0\"} :install-deps true}" -r
Works with `-d out`
clj -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.339\"}}}" -m cljs.main -co "{:npm-deps {left-pad \"1.3.0\"} :install-deps true}" -d out -r

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated: