Is it possible to require dependencies in a .cljs file loaded via :require-cljs true from a Clerk viewer? Where would I have to declare them?
When I declare a dependency directly in deps.edn and require it in my cljs file, Clerk cannot find the namespace, so I assume this is not the right way to do it.
Just created the issue with a test repo: https://github.com/nextjournal/clerk/issues/718 Is there an issue in spec?
it depends. Clerk looks for cljs and cljc files on the classpath, so it should work for files coming from libraries as long as they are runnable in sci.
what’s the depedency and namespace you’re trying to load? Can you push a small repro somewhere?
I tried to require a library of my own (https://clojars.org/eu.formsandlines/formform - works both in clj and cljs), but get an exception "Could not find source for CLJS namespace: clojure.math", so I tried to just require clojure.math on its own, which doesn’t work either, even though it should be in the ClojureScript core?
My lib depends on the log function from clojure.math. I have seen that it was introduced in Clojure 1.11, so maybe has not been included in SCI? However, the clojure.math.combinatorics ns works just fine. Some other libs I tried also have namespaces missing (e.g. clojure.spec.alpha in https://github.com/oakes/odoyle-rules).
ah, think we need to add it to the builtins. Would you mind filling an issue with these details?
You mean on the Clerk repo? Sure, can do that.
or actually try https://github.com/nextjournal/clerk/commit/319c00221862ee3fb975a3b75bdc1d6b5d9e0754
Great, this works! Although now it’s missing clojure.spec.alpha (maybe also clojure.spec.gen.alpha, if this is not included) and goog. 🙂 Can they all just be added to the list or is there more work involved?
what from goog? (Parts should be there already)
if you need more it might be best to create an issue with a repro
then we can validate things are working
and not sure regarding spec.alpha
I may be a little late but I just upgraded clerk and love the new stack traces!