Fork me on GitHub
#shadow-cljs
<
2021-12-02
>
Drew Verlee00:12:14

i'm able to eval expressions in one file but not another in the same project. my emacs buffers says its connected in one but not the other. I can't imagine how this could be.

thheller05:12:51

sorry can't answer emacs questions at all

Drew Verlee15:12:12

What editor do you use if i might ask?

thheller15:12:40

Cursive

👍 1
zeitstein12:12:37

Maybe I'm misunderstanding something, but here goes. I have :paths ["src/main" "resources"] in deps.edn and :dev-http {8000 "classpath:public"} in shadow-cljs.edn. The dev server serves index.html correctly from resources/public when requested from localhost:8000, but any other URL results in 404. From the https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http, I would expect that resources/public/index.html is served, rather than resulting in 404, correct? If I change to :dev-http {8000 "resources/public"} it works as expected. Wondering if its caused by something in shadow.http.push-state/handle.

thheller19:12:07

yes, that handler assumes files not resources

thheller19:12:26

feel free to open an issue about this. can't get to it right now

Ryan16:12:55

Ok, working today and suddenly I'm getting errors about a node package not being available, even though it was there the a second ago. I restarted the computer (it helped yesterday) and to no avail today. Error message is :

pnx-web.js:1455 Module not provided: module$node_modules$primereact$menu$menu_cjs

Ryan16:12:52

Updated all packages that had updates (re-frame-10x and shadow-cljs) .. compiler runs fine, imports are present.

Ryan16:12:12

If I look at the included js in chrome, I can navigate through node modules to get to the offending module and it does appear to be there.

shadow$provide["module$node_modules$primereact$menu$menu_cjs"] = function(global,require,module,exports) ...

Ryan16:12:31

Ooh, It may have been an errant capital P in the import, but not sure yet.

Ryan16:12:14

Nope, it does not seem to have been that.

David Vujic17:12:09

Could it be something with ES vs CommonJs imports? Maybe you have updated a dependency with breaking changes?

Ryan17:12:59

Thats a good question. I'm using a great many prime react modules and the rest seem to work. The update I did that seemed to trigger this was updating IntelliJ, tho I can't clearly see what that would have impacted.

Ryan17:12:19

When I first did that (yesterday), the Button module wasn't working, but a reboot got everything going again and button has not been cranky since

Ryan17:12:59

Ok so I think the errant capital P has lived on

Ryan17:12:40

SHADOW_ENV.evalLoad("module$node_modules$primereact$menu$menu_cjs.js", true, "shadow$provide.module$node_modules$Primereact$menu$menu_cjs\x3dfunction(global,require,module,exports) ...

Ryan17:12:37

There's def. no reference to PrimereactMenu in the requires anymore (there was 1) .. I nuked it from orbit, but it seems like something somewhere has cached it? The rest of the modules are lowercase as they should be.

David Vujic17:12:49

I guess you've already tried it, but if you haven't already: a rm -rf node_modules and an npm install usually does the trick 😄

Ryan17:12:11

hmm I tried npm ci but the shouldn't hurt!

Ryan17:12:26

I've tried so many things to get my project building in last 3 hours that I cant remember what I did when 😄

David Vujic17:12:25

Another trick is to go back in git history step by step until things start working again 😄

👍 1
Ryan17:12:32

So the compile process is generating references to Primereact still.. if I go into the compiled files and edit them all back to lowercase my project is back

Ryan18:12:57

There is one that pops back into the compiled file every time, not sure where its getting it from

Ryan18:12:20

The SHADOW_ENV stuff

Ryan18:12:31

@U05224H0W any clues? I'm stumped at how to fix this. I checked the js module itself for references to Primereact instead or primereact and it does not appear to be causing the capital P to recur.

thheller18:12:42

did you try wiping .shadow-cljs/builds and restarting shadow-cljs?

thheller18:12:15

I don't really know what you are doing but usually errors such as this are user errors

thheller18:12:33

ie. did you modify your :modules config but did not adjust actually loading those modules in your HTML?

thheller18:12:43

did you maybe change your :output-dir and just continue loading a mix of old and new files?

Ryan18:12:39

I am almost certain it is user error 🙂

Ryan18:12:40

I definitely had an errant require statement with a capital P, which I then eliminated but builds after kept going back to it regardless of npm ci / rebuild npm etc.

Ryan18:12:12

Nuking the .shadow-cljs/builds folder fixed it!

thheller18:12:22

which shadow-cljs version do you use?

pez07:07:48

How do you require and use primereact things, @rdonahue? I tried to use the splitter and doing

(:require ["primereact/splitter" :as splitter])
results in splitter evaluating to:
{"Splitter" #js
             {"$$typeof" #object [Symbol (react.memo)],
              :compare nil,
              :type #js {"$$typeof" #object [Symbol (react.forward_ref)], :render #object [Function]}},
 "SplitterPanel" #object [require]}
which I couldn’t figure out how to make reagent render… At some point I even had:
{"Splitter"
   #js
    {"$$typeof" #object [Symbol (react.memo)],
     :compare nil,
     :reagent-compiler2 #js
                         {"$$typeof" #object [Symbol (react.memo)],
                          :compare #object [reagent$impl$component$functional_render_memo_fn],
                          :type #object [Function]},
     :type #js {"$$typeof" #object [Symbol (react.forward_ref)], :render #object [Function]}},
 "SplitterPanel" #object [require]}
Which is extra weird to me, with the :reagent-compiler2 thing there…

rolt08:07:09

[:> splitter/Splitter {}
 [:> splitter/SplitterPanel {} "panel 1"]
 [:> splitter/SplitterPanel {} "panel 2"]]
this works for me But in my code I have (:require ["primereact/splitter" :refer [Splitter SplitterPanel]) and I use the objects directly

thheller09:07:23

don't revive 2 year old threads please. just ask your question 😛

👍 2
thheller09:07:58

the "$$typeof" property is a hint that this is a react element, a memoized element in this case

thheller09:07:08

so yeah, you just render it as @U02F0C62TC1 said

pez09:07:43

I’ve tried doing it the @U02F0C62TC1 way. Will give it another go now that I know it should work.

pez13:07:12

Well, now tried again and it just worked. Don’t know what I was trying yesterday… Thanks, and sorry for the noice and for resurrecting a pretty unrelated thread!

pez07:07:48

How do you require and use primereact things, @rdonahue? I tried to use the splitter and doing

(:require ["primereact/splitter" :as splitter])
results in splitter evaluating to:
{"Splitter" #js
             {"$$typeof" #object [Symbol (react.memo)],
              :compare nil,
              :type #js {"$$typeof" #object [Symbol (react.forward_ref)], :render #object [Function]}},
 "SplitterPanel" #object [require]}
which I couldn’t figure out how to make reagent render… At some point I even had:
{"Splitter"
   #js
    {"$$typeof" #object [Symbol (react.memo)],
     :compare nil,
     :reagent-compiler2 #js
                         {"$$typeof" #object [Symbol (react.memo)],
                          :compare #object [reagent$impl$component$functional_render_memo_fn],
                          :type #object [Function]},
     :type #js {"$$typeof" #object [Symbol (react.forward_ref)], :render #object [Function]}},
 "SplitterPanel" #object [require]}
Which is extra weird to me, with the :reagent-compiler2 thing there…