Skip to content

Commit e75706a

Browse files
mfikesdnolen
authored andcommitted
CLJS-2775: cljs.main: Node modules not installed if -re node
If you look at the (non-cljs.main) REPL startup sequence in cljs.repl/repl*, maybe-install-npm-deps is called prior to run-inits, but in cljs.cli, there is a call to run-inits without first ensuring that maybe-install-npm-deps has been called. This is simple to fix by explicitly making such a call before run-inits is called.
1 parent fed0807 commit e75706a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/clojure/cljs/cli.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ present"
352352
`(set! *command-line-args* (list ~@args))))
353353
(repl/evaluate-form renv (ana-api/empty-env) "<cljs repl>"
354354
`(~'ns ~'cljs.user))
355+
(repl/maybe-install-npm-deps opts)
355356
(repl/run-inits renv inits)
356357
(when script
357358
(cond

src/test/cljs_cli/cljs_cli/test.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,12 @@
106106
(output-is
107107
nil
108108
4))))
109+
110+
(deftest test-cljs-2775
111+
(with-repl-env-filter #{"node"}
112+
(-> (cljs-main
113+
"-co" "{:npm-deps {:left-pad \"1.3.0\"} :install-deps true}"
114+
"-d" "out"
115+
"-e" "(require 'left-pad)"
116+
"-e" "(left-pad 3 10 0)")
117+
(output-is "nil\n\"0000000003\""))))

0 commit comments

Comments
 (0)