Multiple requires of Node.js modules in non :nodejs target are not idempotent at the REPL

Description

Given the following setup:

1 2 3 4 5 6 7 8 9 (require '[cljs.repl :as r]) (require '[cljs.repl.browser :as rb]) (def opts {:browser-repl true :verbose true :npm-deps {"lodash" "4.17.4"}}) (r/repl* (rb/repl-env) opts)

Under a REPL when the target is not the Node.js the following behavior is observed:

1 (require '["lodash/array" :as lodash-array])

Will succeed the first time. The same require a second time produce the following stack trace:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 clojure.lang.ExceptionInfo: No such namespace: module$Users$davidnolen$development$clojure$hello-world$node-modules$lodash$array, could not locate module$Users$davidnolen$development$clojure$hello_world$node_modules$lodash$array.cljs, module$Users$davidnolen$development$clojure$hello_world$node_modules$lodash$array.cljc, or JavaScript providing "module$Users$davidnolen$development$clojure$hello-world$node-modules$lodash$array" at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 1, :root-source-info {:source-type :fragment, :source-form (require (quote ["lodash/array" :as lodash-array]))}, :tag :cljs/analysis-error} at clojure.core$ex_info.invokeStatic(core.clj:4617) at cljs.analyzer$error.invokeStatic(analyzer.cljc:690) at cljs.analyzer$error.invoke(analyzer.cljc:690) at cljs.analyzer$error.invokeStatic(analyzer.cljc:692) at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:2111) at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:3430) at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:3424) at cljs.analyzer$analyze_STAR_$fn__2393.invoke(analyzer.cljc:3546) at clojure.lang.PersistentVector.reduce(PersistentVector.java:341) at clojure.core$reduce.invokeStatic(core.clj:6544) at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:3543) at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:3569) at cljs.analyzer$analyze.invoke(analyzer.cljc:3553) at cljs.analyzer$analyze_seq.invokeStatic(analyzer.cljc:3350) at cljs.analyzer$analyze_form.invokeStatic(analyzer.cljc:3498) at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:3543) at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:3569) at cljs.repl$evaluate_form$fn__6113.invoke(repl.cljc:496) at cljs.repl$evaluate_form.invokeStatic(repl.cljc:496) at cljs.repl$eval_cljs.invokeStatic(repl.cljc:616) at cljs.repl$eval_cljs.invoke(repl.cljc:603) at cljs.repl$repl_STAR_$read_eval_print__6234.invoke(repl.cljc:865) at cljs.repl$repl_STAR_$fn__6240$fn__6249.invoke(repl.cljc:905) at cljs.repl$repl_STAR_$fn__6240.invoke(repl.cljc:904) at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1224) at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:841) at cljs.repl$repl_STAR_.invoke(repl.cljc:745) at user$eval1109.invokeStatic(repl.clj:19) at user$eval1109.invoke(repl.clj:19) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$script_opt.invokeStatic(main.clj:335) at clojure.main$script_opt.invoke(main.clj:330) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at clojure.lang.AFn.applyToHelper(AFn.java:154) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37)

Environment

None

Status

Assignee

Unassigned

Reporter

David Nolen

Labels

Approval

Vetted

Patch

None

Fix versions

Affects versions

1.9.854

Priority

Blocker
Configure