Fork me on GitHub
#shadow-cljs
<
2019-07-05
>
pberganza00:07:32

Has anyone here tried to use react-router with shadow-cljs? I'm trying to use hx and react-router. If I try to navigate using the address bar to a route like // it fails saying it cannot find a LOT of scripts located at //js/cljs-runtime/.js (I think it tries to take the first part as the root "/"). If it's only / it works perfectly. (Tried with the same component). Both work perfectly if I navigate within the app using anchors.

pberganza05:07:24

I tried replacing react-router with reitit, accountant and clerk and I'm still having the same issue.

p-himik06:07:33

What is your :asset-path?

❤️ 4
thheller08:07:36

yeah you are likely including your JS via a relative path. make sure your :asset-path starts with a / and your <script tag including the initial JS does as well

❤️ 4
pberganza15:07:48

omg... that's it. Of course... thanks a lot! I wouldn't have figured that out myself. ❤️

Ahmed Hassan16:07:47

How I can check which dependencies are included in build?

Ahmed Hassan16:07:36

I've declared dependencies in : dependencies vector in shadow-cljs.edn.

Ahmed Hassan16:07:20

The required namespace "' is not available, ...

Ahmed Hassan16:07:43

But it is showing error given above.

Ahmed Hassan16:07:18

Would using deps.edn instead of shadow-cljs.edn solve this problem?

thheller17:07:28

@ahmed1hsn no. which dependency did you add? and did you restart the shadow-cljs process after adding it?

Ahmed Hassan18:07:20

[keechma/toolbox "0.1.6"]

Ahmed Hassan18:07:03

Thanks it got solved, I was using old dependencies.

chrisblom17:07:31

i'm building a cljs frontend (using shadow-cljs) and a clj backend (using deps.edn). I'm running the frontend with shadow-cljs watch and the backend with a normal repl. A disadvantage to running is that the dev server for the frontend is running on a different port than the backend. Is there a way to run the dev shadow cljs server in the same process and port than the backend server?

thheller17:07:23

you can just serve the output-dir normally using your CLJ server

thheller17:07:26

they are normal static files

chrisblom17:07:30

ah yes, that should work, but it will not offer the reload-on-edit that shadow-cljs offers right?

thheller17:07:01

that will work as normal. the webserver serving the files is not involved in that

thheller17:07:35

the only thing you need to watch out for when serving the files yourself is proper cache invalidation

thheller17:07:48

otherwise you may get weird results

chrisblom17:07:43

oh cool, thanks, will give this a try