I'm having trouble with assets. There is this template that references source files, but in the built package all the paths are like ./assets/name-abcdef.ttf and such. That package uses vite to build the template I think. Is there a sane way to refer to these assets in the distributed package?
EXACTLY but when you build the package vite bundles everything into names with hashes in them. So inside node_modules you don't just have index.js but index-randomhex.js and randomhex is a hash of the content. So there doesn't appear to be a stable way to refer to the assets in the compiled package
why are you asking me a question about vite? I'm missing crucial information here?
how is shadow-cljs involved in this? so far I haven't seen any CLJS
I was hoping this is some standard JS module scheme that shadow-cljs has a way of dealing with
if you explain how shadow-cljs is involved in this and what you are trying to do I can maybe make suggestions
right now I'm just lost and have no clue what the actual issue is
Like, vite transforms the source references to hashed asset references. I was hoping to replicate that so that I can refer to index.js and then shadow-cljs compiles that to index-hex.js` but maybe this is just a vite problem where the assets are essentially "private" internal names that I'll have to work around.
please take about 5 steps back and describe the problem you are trying to solve
do no mention vite or whatever. I cannot answer questsions about vite.
Sure
So I added a package as a dependency and I want to load the JS files inside it. But the JS files have weird hashed names. I was hoping this is some C++ name mangling type deal that tools in the JS ecosystem know how to deal with.
But I'm starting to think this is not some type of "ES module" thing but rather their bundler making "private" assets that can't be reliably loaded externally.
ok so this is a normal npm dependency?
the hashed names is not normally something you'd refer to directly. usually package.json will have some sort of aliasing so that you can use normal names and it gives you the hashed name
assets are a different story, but I need specifics because there are about a million different ways these things are done, so I cannot give a generic answer
the file: https://github.com/marimo-team/marimo/blob/main/frontend/index.html
just move the assets folder from src/assets to public/assets
then just use /assets/whatever in the html
not sure what you mean by "distributed package"
The weirdness is that they use vite to assemble everything and it puts the content hash in the filename so if you just copy assets from node_modules to public they have hashes in the name so it's very fragile
yeah sorry I do not understand what kind of setup you are using. the files must be somewhere? in the repo you linked its all just regular files?