We're updating the issue view to help you get more done. 

"No such namespace" warning when referring to JS module namespace without using alias

Description

Currently, when requiring a JS module it is not possible to refer to it using the original namespace. For example, the following code will result in a warning:

1 2 3 4 (ns my-calculator.core (:require [my.calc])) (println (my.calc/add 5 5))
1 2 WARNING: No such namespace: my.calc, could not locate my/calc.cljs, my/calc.cljc, or Closure namespace "" at line 4 src/my_calculator/core.cljs WARNING: Use of undeclared Var my.calc/add at line 4 src/my_calculator/core.cljs

And the resulting JavaScript will throw the following error:

1 Uncaught ReferenceError: my is not defined

However, defining an alias for the JS module and using it works fine, for example:

1 2 3 4 (ns my-calculator.core (:require [my.calc :as calc])) (println (calc/add 5 5))

Here is a minimal repo to reproduce this problem: https://github.com/mneise/my-calculator.

Environment

None

Status

Assignee

David Nolen

Reporter

Maria Geller

Labels

None

Approval

None

Patch

None

Affects versions

1.9.76

Priority

Minor