Skip to content

"No such namespace" for ns from foreign-libs libs when eval ns-form at repl #49

@maacl

Description

@maacl

Expected behavior

=> nil

Actual behavior

clojure.lang.ExceptionInfo: No such namespace: chrono, could not locate chrono.cljs, chrono.cljc, or Closure namespace "chrono" in file <cljs repl> {:tag :cljs/analysis-error}
    at clojure.core$ex_info.invoke(core.clj:4593)
    at cljs.analyzer$error.invoke(analyzer.cljc:610)
    at cljs.analyzer$error.invoke(analyzer.cljc:608)
    at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1708)
    at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:2559)
    at cljs.analyzer$analyze_STAR_$fn__4491.invoke(analyzer.cljc:2644)
    at clojure.lang.PersistentVector.reduce(PersistentVector.java:333)
    at clojure.core$reduce.invoke(core.clj:6518)
    at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2644)
    at cljs.analyzer$analyze.invoke(analyzer.cljc:2659)
    at cljs.repl$evaluate_form.invoke(repl.cljc:454)
    at cljs.repl$eval_cljs.invoke(repl.cljc:574)
    at cljs.repl$repl_STAR_$read_eval_print__8416.invoke(repl.cljc:880)
    at cljs.repl$repl_STAR_$fn__8422$fn__8431.invoke(repl.cljc:919)
    at cljs.repl$repl_STAR_$fn__8422.invoke(repl.cljc:918)
    at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1154)
    at cljs.repl$repl_STAR_.invoke(repl.cljc:882)
    at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:169)
    at clojure.lang.AFn.applyToHelper(AFn.java:171)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:634)
    at cemerick.piggieback$evaluate.invoke(piggieback.clj:258)
    at clojure.lang.Var.invoke(Var.java:379)
    at cemerick.piggieback$wrap_cljs_repl$fn__8909$fn__8911$fn__8912.invoke(piggieback.clj:290)
    at cemerick.piggieback$enqueue$fn__8895.invoke(piggieback.clj:246)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1996.invoke(interruptible_eval.clj:190)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Steps to reproduce the problem

boot dev

cider-connect to nrepl created by boot or boot repl -c

(start-repl)

Switch to source buffer, C-c-v-n to eval namespace declaration
or
pass namespace declaration to repl.

Project compiles fine with no errors. This issue appears confined to the repl.
The namespaces pm and chrono come from two javascript libs included via the foreign-libs compiler option - please see relevant parts of build-boot. If I remove the foreign-libs namespaces everything works as expected.

ns form looks as follows:

(ns app.core
  (:require-macros [hiccups.core :as hiccups :refer [html]])
  (:require [app.validation :as validation]
            [app.data :as data]
            [bouncer.core :as b]
            [pm]
            [chrono]))

build.boot contains:

(deftask dev []
  (comp (serve :dir "target/")
        (watch)
        (speak)
        (reload :on-jsload 'app.core/main)
        (cljs-repl)
        (cljs :source-map true
              :optimizations :none
              :compiler-options {:foreign-libs
                                 [{:file "src/js/prosemirror.js"
                                   :provides ["pm"]}
                                  {:file "src/js/chrono.js"
                                   :provides ["chrono"]}]
                                 :externs ["src/js/externs.js"]})
        (target :dir #{"target/"})))

Environment & Version information

CIDER version information

;; CIDER 0.14.0snapshot (package: 20160830.23)
;; Clojure 1.7.0
;; openjdk version "1.8.0_91"
;; OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
;; OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

Lein/Boot version

;; BOOT_VERSION=2.6.0

Emacs version

GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-08-23

Operating system

Ubuntu 16.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions