#Loading images in Vite project

1 messages · Page 1 of 1 (latest)

grave holly
#

I had some problems loading images in my app, and since my app was on an older version of Remix, I just decided to start from scratch with the new Vite/Remix template. However, after moving my code over to the new project I still cannot see my images in deployed versions of my app, but everything works fine on localhost. My deployed apps are on fly.io.

I have some images:

- app
  - assets
    - images
      - logo.jpg
    - symbols
      - completed.png

Which I import like this:

import Completed from "@/assets/symbols/completed.png";

import logo from '~/assets/images/logo.jpg'

I also have an image in:

- public
  - other_logo.jpg

Which I use as:

<img src="/other_logo.jpg" alt='Logo' className="w-[32px] mr-2"/>

And it too works on localhost but not when deployed.

Any suggestions on where to start looking for the problem?

#

I should add that icons that I import from react-icons show up just fine

fleet charm
#

go into your fly container with flyctl ssh console and navigate to the public directory to see if your images are there

#

if they're not, check your Dockerfile to make sure it's copying them over