I'm struggling a bit with running CLJS compiler under Bazel (new rules from scratch for reasons, not using the shared Bazel Clojure libs) and can't figure out what causes this error:
Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/loader__init.class, cljs/loader.clj or cljs/loader.cljc on classpat
h.
at clojure.lang.RT.load(RT.java:466)
at clojure.lang.RT.load(RT.java:424)
at clojure.core$load$fn__7800.invoke(core.clj:6126) at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$compile$fn__7805.invoke(core.clj:6137)
at clojure.core$compile.invokeStatic(core.clj:6136)
at clojure.core$compile.invoke(core.clj:6128)
at clojure.lang.Var.invoke(Var.java:384)
at clojure.lang.Compile.main(Compile.java:70)
I gather that cljs.loader
is very special, and I'm having a hard time figuring out where it actually gets loaded and what might be wrong.@braden.shepherdson that is an error trying to load a CLJS file from CLJ. that ns isn't special, it is just CLJS code not CLJ code.
am I reading it right that src/main/clojure should be the input to clojure.main , while src/main/cljs should be data files available at runtime?
not really? all the files are required by the CLJS compiler. none of the are required at "runtime" if you are referring to the runtime of the final JS output? (as the CLJS compiler will have turned the relevant files into JS code)
I think the problem is actually that this rule wants to AOT-compile the Clojure code and then run it, hence the compile- and run-time distinction.
if you have everything AOT compiled and those classes available you can maybe get away with just src/main/cljs. but there are some .cljc files so might be safer to just keep src/main/clojure as well, if you run the self-hosted compiler you'll need all of it regardless
hm. maybe that's the trouble; I don't think I tried it with src/main/clojure
as the srcs and both as data.
🎉 I managed to get --help
to work.