3 ms·
This is quite a large question to answer. From viewpoint of compiler, there is no much distinction between local and external packages. Clojure (and so Clojure
by juhoteperi 9y ago
This is quite a large question to answer.
From viewpoint of compiler, there is no much distinction between local and external packages. Clojure (and so ClojureScript compiler) is built on to of JVM and uses Maven dependencies so that is where most of the dependencies come from. From viewpoint of compiler, all files are in JVM classpath (or in directories specified in Cljs compiler options).
Om declares it's dependencies in project.clj file: https://github.com/omcljs/om/blob/master/project.clj#L13 https://github.com/omcljs/om/blob/master/project.clj#L13
- om.dom, based on the name, compiler will look for om/dom.cljs/cljc files in classpath, and in this case the file is local to the project
- cljsjs.react is foreign-library (https://clojurescript.org/reference/packaging-foreign-deps https://clojurescript.org/reference/packaging-foreign-deps) provided by external cljsjs/react package. Compiler indexes all these foreign-libraries at start, so when it encounters require to one of them knows what to do
- goog.dom is Closure module provided by Google Closure library (https://github.com/google/closure-library https://github.com/google/closure-library), which is dependency of ClojureScript. Compiler will look for goog/dom.js file if no .cljs or .cljc by the name is found.