Fork me on GitHub
#clojurescript
<
2022-12-29
>
Tala Tarazi08:12:36

Hello Clojurians, I'm working with https://github.com/clj-commons/https://github.com/clj-commons/hickory on my clojurescript code, and I have a line of code that works perfectly locally. but when I deploy my code using( npm run release) It breaks and I get an error. Code : (map as-hiccup (parse-fragment field)) Error: Error: No matching clause: 1 Can anyone explain why and how to fix it? Thank you!

p-himik08:12:13

What's the stacktrace of the error?

thheller09:12:18

do you use shadow-cljs? if so you can add --pseudo-names or --debug to the release build to make it easier to figure out where the problem is

thheller09:12:04

the error suggests a broken case expression

Tala Tarazi09:12:37

Ok so I added the --pseudo-names and I got

Tala Tarazi09:12:35

ok here's a better image of the error source

p-himik09:12:52

Hickory uses aget with goog - I bet that's the issue. IIRC, during advanced optimizations, goog stuff gets minified. But aget (which is designed to work only with arrays) tries to access a non-minified field. So that condp above probably ends up having a bunch of undefined as clauses instead of all those Attribute, Comment, etc.

Tala Tarazi10:12:41

Do you have any idea of how can I make it work?

p-himik10:12:06

1. Confirm that it's indeed the case by using a local version of the library where you replace aget with goog.object/get 2. If that works, create an issue and a PR for the library and in the mean time, if you're in a hurry, use a vendored-in version of the library

p-himik10:12:12

Alternatively, it should be possible to re-extend the right protocols to object and use a correct implementation. But that's hardly less work, with 0 benefit to the community and a potential for future breakage when you update Hickory.