Open bronze opened 10 months ago
I have similar problem with og:image: images are copied to destination folder, but they get -<hashcode>
appended to image file name in order to improve caching issues for production site.
I have checked Vite code and it seems that they should prpoprly process <meta>
tags with og:image
property, however they do not do this on my project.
I have also submitted but to vite with more information: https://github.com/vitejs/vite/issues/14627
Shoot. I have just spent two straight days debugging the exact same issue and thinking I am going crazy.
The awful part of the bug is that it was not possible to debug it using DEBUG env set for npm run build
. I saw my
addPassthroughCopy
image files copied over to my dist folder - and then, when I examined my dist folder - copied files were not there. My eleventy config file was big so it was a huge pain to investigate this, by commenting out things one by one.
Vite silently removes my copied files!
Having used the Slinkity plugin, I've come across this issue. Vite in general only processes assets that is needs, removing any files that aren't directly resolved through html files.
Eleventy will build into a temp folder first, and then Vite plugin looks at that folder to process the final build. Passthrough copy, will copy files to the temp folder, and then Vite processes what it needs from there, and removes the rest. Chances are Vite is not considering these files for final build.
Best bet is use the 'public' folder top level of the project. Get eleventy to passthrough copy that public folder and Vite will then process that folder to the final build. Only downside to that is these files won't be hashed, they just get copied from one directly to another.
--public
|- meta
|- og-image.png
-- src
|- project files
becomes the following for final build.
--/dist
|- meta
|- og-image.png
--index
--etc
There's a little more about it on the Slinkity docs: stripped assets
Hi
I've been cracking my head on this one and would appreciate another view. I have
eleventyConfig.addPassthroughCopy('src/assets/images')
set up because i want to use the images on myog:image
tags.However, when building for production, all my images vanish around the time we hit his part
I've tried changing the name of the folder because I thought maybe it may have something to do with using the assets folder, but no deal. Tried passing
emptyOutDir: false,
onviteOptions
but also didn't solve.Anyone else encountered this?
Thanks