#Images not rendering vercel

46 messages · Page 1 of 1 (latest)

gusty pebble
#

Do they render locally?

#

Can you share the logs from the dev tools?

split raptor
gusty pebble
#

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?

split raptor
#

This is my project directory

split raptor
gusty pebble
#

You should change you img path from "../../public/img/home.png" to "/img/home.png"

#

or "img/home.png"

gusty pebble
split raptor
#

The images are correct in /public right?

#

I put this /img/home.png" but still does not render images

gusty pebble
gusty pebble
#

npm run build

#

npm run preview

#

see if the images render

split raptor
#

In vercel or in localhost?

gusty pebble
#

localhost

gusty pebble
split raptor
gusty pebble
#

Can you share your astro.config.cjs file

split raptor
#
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()
});
gusty pebble
#

You forget to import vercel adapter

#

npm install @astrojs/vercel

#

import vercel from '@astrojs/vercel/serverless'; in astro.config.cjs

split raptor
#

There is

#

Check it

gusty pebble
#

oops, didn't see that

split raptor
#

Np

gusty pebble
#

run npm run build

#

and share the logs

split raptor
gusty pebble
#

Move your css/ dir to src/

#

Take a look into your dist dir, public/ probably doesn't exit

split raptor
gusty pebble
#

i.e, Layout.astro

split raptor
gusty pebble
#

Carefully read it

split raptor
#

I tried to delete dist and regenarate it, but didn't works