-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized pictures cannot be found for blog post cover pictures in preview #10
Comments
If I remember correctly, I ran into a similar problem recently because I had updated npm. |
@vvirta what happens if you run the optimize-images command by itself (npm run optimize-images)? Does it generate the webp and avif files? If it does, then maybe the issue is likely with the “postbuild” script not running. If that’s the case, then there wouldn’t be a sitemap.xml file in the build folder. I’ve never used pnpm, but I don’t think it should affect the build process… You can also try running the build and preview commands with npm instead and see if that works, just for peace of mind |
Sorry for long delay. Trying again to troubleshooting today.
I believe I do not understand some fundamental topic around vite/preview/build now.
|
Using npm fixed my issue of deploying to production and now I can see that all the cover pictures are working there. |
Just a note I think is correct - someone can correct me if not - If you place pictures in static folder Svelte does not process them at all using as is. Im also playing with this project and finding pictures are disappearing if used from "static" folder in localhost . Yet visible in Front Matter Dashboard. |
@marksteven only images in the /static/images folder will be processed, but you can change that if you need. What runs the optimization is the |
I returned back to this issue while investigating something else, and found the following post after asking ChatGTP to explain me the difference between /.svelte-kit/output and /build:
|
This is very likely user error, as I'm not too experienced. I will record it in any case, so that the eventual fix will be visible to others.
I have edited the template here and there, added blog posts and now it got ready for first deployment. I have tested so far only with
pnpm dev
. When i ranpnpm run build
andpnpm preview
for the first time I came up with an issue where cover pictures or picture that I replaced the Svelte-logo in about section of landing page are not visible.When firing the preview, I get these error messages:
In my static/images/posts -folder I have eg. jpeg or png version and blog posts that refer to those directly in content show the pictures ok. the build/images/posts -folder has all the different picture formats available, but when I visit localhost:4173, those pictures return error message and cannot be found. When inspecting one missing image I see this:
<img srcset="/images/posts/library.avif, /images/posts/library.webp, /images/posts/library.png" src="/images/posts/library.jpeg" alt="Second Brain" loading="lazy" decoding="async" class="svelte-1ykl0dj">
The original version of the image works: http://localhost:4173/images/posts/library.jpeg but all other formats return error.
The text was updated successfully, but these errors were encountered: