Fork me on GitHub
#clojurescript
<
2022-06-20
>
pez06:06:44

Apparently, this is not how you consume npm packages with plain ClojureScript: https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules. Is there some other way it should be done? My Google fu fails me.

thheller07:06:02

for node however I'm not totally sure. it shouldn't require :target :bundle. should just be using require directly

thheller07:06:26

also not sure how this works with the REPL

pez07:06:57

I'll give this a shot. I am perfectly happy with using shadow-cljs in my real use case. Just got a bit surprised I couldn't figure out how to do it with plain ClojureScript.

pez07:06:41

The part about overriding foreign libs is s a bit confusing, btw. It seems to assume the package exists at cljsjs?

thheller07:06:53

if you ask me the whole thing is in a bit of a messy state. there seem to be two somewhat conflicting implementations and I'm not sure how either is supposed to work

pez07:06:08

Thanks. Maybe I'll just close this box for now. I've solved my use-case anyway. 😃

jrychter08:06:45

Upgrading from ClojureScript 1.11.4 to 1.11.51 completely breaks my Rum app. Breaks as in "TypeError: Cannot read properties of undefined (reading 'call')". Really baffled, because it seems like Rum components do not receive the same arguments that were passed to them (the first two disappear?). I've been reading the changelog, but I can't figure out which change could be so invasive.

thheller08:06:12

@jrychter that error you get when calling nil as a function. so (x 1 2 3) when x is nil. are you sure its not something else you changed?

jrychter08:06:48

No. Switching the ClojureScript version itself is enough to break things in multiple places.

jrychter08:06:59

And by "multiple places" I mean that another component breaks with "Objects are not valid as a React child (found: object with keys {ns, name, fqn, hash, cljs$lang$protocolmask$partition0$, cljs$lang$protocol_mask$partition1$}). ", because a parameter that should contain a hiccup vector now contains… something else entirely.

thheller08:06:31

looks like a keyword or symbol

thheller08:06:35

I can't think of anything in particular. are you maybe on an older rum version?

jrychter09:06:20

[rum "0.12.9"]

jrychter09:06:24

I think I will report this as a Rum issue and try to seek advice there, because it appears that ClojureScript changes completely broke Rum. But I'm very, very puzzled by all this. I usually expect ClojureScript version changes to be unnoticeable.

thheller09:06:54

a repro would definitely help. there definitely haven't been any intended breaking changes in cljs itself. maybe rum was just relying on some undefined behavior that got fixed or something

jrychter09:06:02

These errors were with :optimizations :none — I now tried running the compiled version of the app and it breaks with "app.js:1 Uncaught ReferenceError: goog is not defined at app.js:1:1 (anonymous) @ app.js:1". 👀 Well, I guess I have to stay on ClojureScript 1.11.4.

phill11:06:01

ClojureScript recently "vendored" certain off-the-shelf things, which your project might have informally depended upon without declaring (or you might have :excluded them to avoid conflicts)... see https://clojurescript.org/news/news ... perhaps you need to add one or more of them back?

jrychter12:06:46

Hmm, if you mean tools.reader, data.json, and transit-clj, then I depend on all of those explicitly anyway. And I don't think this would cause a change in how args are passed to Rum components…

danieroux12:06:28

You need this to be set to true: :global-goog-object&array https://clojurescript.org/reference/compiler-options

danieroux12:06:50

(I believe, anyway)

jrychter18:06:12

It would appear that CLJS-3382 is the culprit for the breakage I'm seeing, at least according to the author of Rum (https://clojure.atlassian.net/browse/CLJS-3382).

💯 1
🎉 1
😅 1