#Images not rendering vercel
46 messages · Page 1 of 1 (latest)
Yes
does you root directory setting look like this in Vercel project setting?
if you code is open source? can you share the link to repo?
This is my project directory
Is not open source, is a private repo
You should change you img path from "../../public/img/home.png" to "/img/home.png"
or "img/home.png"
read about /public
Where would you put the CSS?
The images are correct in /public right?
I put this /img/home.png" but still does not render images
Your CSS files should be in src/
Try this:
npm run build
npm run preview
see if the images render
In vercel or in localhost?
localhost
try changing it to img/home.png
Can you share your astro.config.cjs file
import { defineConfig } from 'astro/config';
import astroI18next from "astro-i18next";
// https://astro.build/config
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
import vercel from "@astrojs/vercel/serverless";
// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), astroI18next(), react()],
output: "server",
adapter: vercel()
});
You forget to import vercel adapter
npm install @astrojs/vercel
import vercel from '@astrojs/vercel/serverless'; in astro.config.cjs
oops, didn't see that
Np
Move your css/ dir to src/
Take a look into your dist dir, public/ probably doesn't exit
Is moved
Did change the path where you used it?
i.e, Layout.astro
There is a dist folder but the css and img folder are empty.
I tried to delete dist and regenarate it, but didn't works