Fork me on GitHub

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.


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


What is your :asset-path?

❤️ 4

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

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?


@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.


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?


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


they are normal static files


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


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


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


otherwise you may get weird results


oh cool, thanks, will give this a try