I'm trying to debug a module problem. I have a library "katex" that I load in exactly one namespace
(ns nextjournal.clerk.katex
(:require ["katex" :as katex]))
(defn renderToString [s]
(katex/renderToString s))
My modules look like this:
:modules {:viewer {:entries [nextjournal.clerk.sci-env
nextjournal.clerk.trim-image]}
:katex {:entries [katex nextjournal.clerk.katex]
:depends-on #{:viewer}
:exports {renderToString nextjournal.clerk.katex/renderToString}}}
Yet I get the error:
Module Entry "katex" was moved out of module ":katex".
It was moved to ":viewer" and used by #{:katex :viewer}.
I only have the namespace nextjournal.clerk.katex because directly exposing katex resulted in the same error. How can I debug this?so now it works, I got rid of the dependency on nextjournal.markdown. I'm re-trying this:
:katex {:entries ["katex"]
:depends-on #{:viewer}
:exports {renderToString katex/renderToString}}
It works, but I do get a warning:
------ WARNING #1 - -----------------------------------------------------------
Resource: shadow/module/katex/append.js:2:31
variable katex is undeclaredI can wrap it in a CLJS namespace, no problem, but thought I'd mention it
This works fine:
:katex {:entries [katex nextjournal.clerk.katex]
:depends-on #{:viewer}
:exports {renderToString nextjournal.clerk.katex/renderToString}}Just katex didn't work, but "katex" gave the result I first mentioned 1 minute ago
search your code base for nextjournal.clerk.katex. most likely something has a direct ns require for it
I just created this namespace just for the reason to expose katex via a shadow module.
right. then its katex itself.
$ rg '"katex"'
src/nextjournal/clerk/katex.cljs
2: (:require ["katex" :as katex]))
src/nextjournal/clerk/sci_env.cljs
162: #_#_"katex" katex
render/deps.cljs
18: "katex" "^0.12.0"maybe it gets confused by katex and "katex". just remove katex from the :entries
I mean having katex as a symbol and as a string might confuse the thing
has no effect to have it listed there anyway if nextjournal.clerk.katex is the only place requiring it
That works but when I inspect the katex module, I see this:
$ cat build/katex.js
import { $APP, shadow$provide, $jscomp } from "./viewer.js";
const shadow_esm_import = function(x) { return import(x) };
export const renderToString=function(a){return $APP.Vub.renderToString(a)};
//# sourceMappingURL=katex.js.map
Which looks like katex is just pushed to the viewer module anyway. This is why I added the katex entry.make a build report and check. that will list what is where and why
got it. found why it was pushed there, the nextjournal.markdown lib depends on it. thanks!
I forgot that you can hover the entry in the build report to get more info