Fork me on GitHub
#shadow-cljs
<
2023-10-03
>
stagmoose06:10:43

shadow serve index.html from the public/ folder. is it possible to create a bunch of json files under public/data/ and list those files using only client side code?

thheller06:10:59

list no, access yes

👌 1
thheller06:10:23

that would be an extreme security hole is everyone could just list any directory contents

stagmoose08:10:37

that makes sense haha. thanks for your help!

martinklepsch11:10:25

what might help is having an index.json file that contains paths to all the json files you care about. But it would be up to you to update that index.json file

Yab Mas09:10:20

Hi, I'm upgrading shadow-cljs on a project that hasn't been touched for a while and I'm running into an issue where I'm not sure how to proceed. The upgrade is from version 2.8.61 to 2.25.7. The issue is that we integrate with a product that uses google closure itself; during dev the goog libraries clash. So the project builds, but when I run the artifact in the browser I get Error: Namespace "goog.X" already declared. errors. Release build seems to run fine. The existing fix uses a build-hook and runs the following code in the compile-finish stage (update build-state :unoptimizable str "window.goog = {};" "\n") This worked in the old version but doesn't work anymore after upgrading. I'm unable to find anything about this :unoptimizable key in the documentation and I've understood it was setup from reading the source. I tried setting :prepend and :prepend-js on the module from the build-hook but it seems to be set too late in the js output; i.e. the goog initialisation happens before my :prepend value. Any tips on how to proceed on this?

thheller11:10:43

hmm but how did that work? I mean you are forcefully overriding goog, which means the other stuff using closure gets deleted?

Yab Mas11:10:30

I'm not sure. My interpretation was that we reset the closure library that was initialised by the platform and simply let shadow initialise it again, which is a bit silly but avoids the "already declared" issue. I didn't expect that line to remove any app specific code, just the goog library stuff (and Im also not seeing any behaviour that suggests otherwise). But my understanding of all this is pretty shallow so my interpretation might be wrong. All I know for sure is that this worked with the mentioned older version of shadow (and that I get the same "already declared" errors when I remove the build hook) but that it doesn't work anymore with the newer version. In the end I obviously just want to fix the "already declared" errors and I don't necessarily have to fix this build hook, so if you have advice from a different angle I would be happy with that as well.

Yab Mas11:10:50

I haven't yet upgraded the shadow version incrementally to see where the fix breaks, could do that if it helps.