ClojureScript

cljs.main: load file fails if NPM deps involved

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:
    {:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}}}

Description

src/foo/core.cljs
(ns foo.core
  (:require left-pad))

(defn pad [n]
  (left-pad n 10 0))

We pass -d here to work around CLJS-2752 and CLJS-2666.

$ clj -m cljs.main -co '{:npm-deps {:left-pad "1.3.0"} :install-deps true}' -d out -r
cljs.user=> (load-file "foo/core.cljs")
nil
cljs.user=> (dir foo.core)
pad
nil
cljs.user=> (foo.core/pad 3)
ReferenceError: Can't find variable: foo
cljs.user=> (require 'foo.core)

cljs.user=> (foo.core/pad 3)
"0000000003"

Note that load-file fails (even though it can succeed; see CLJS-2753), while require succeeds.

Activity

There are no comments yet on this issue.

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated: