You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a simple vite plugin that reads the width and height from a video file and returns an object that contains the width, height and src. This is in the context of a 100% static site generated with SvelteKit.
Everything works perfectly fine a dev environment, but on build, the files are getting written to the assets folder with a hash in their name, like every other asset. My question is how can I generate this hashed filename from within my plugin so the src file contains the right url?
If I understand correctly, I only have the src and id information in my plugin transform callback:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a simple vite plugin that reads the width and height from a video file and returns an object that contains the
width,heightandsrc. This is in the context of a 100% static site generated with SvelteKit.Everything works perfectly fine a dev environment, but on build, the files are getting written to the assets folder with a hash in their name, like every other asset. My question is how can I generate this hashed filename from within my plugin so the
srcfile contains the right url?If I understand correctly, I only have the
srcandidinformation in my plugin transform callback:But whatever I do, even calculating my own hash via
…the output unfortunately isn't the same as the hash contained in the asset filename in the build folder.
Does anyone have any documentation or pointers on how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions