skip to Main Content

I have added a few images in src/components/assets/media/images folder but when I am deploying to the Vercel application I am not seeing those files as deployed. It is still showing old set of
files.

enter image description here

enter image description here

These images/png files are there in github and deployment is happening from the same location but I checked it’s not there in deployment.

I don’t understand how to get the path of these logos to be included in external json which is available in monngodb

I am thinking maybe those files are never used in the application that’s why they are appearing in asset_manifest.json.

The existing files are appending a hash before the extension.

2

Answers


  1. Your images are not in the correct folder or have the wrong path.
    Vercel expects your static assets to be in a folder called public at the root of your project, and you should reference them with a slash (/) at the beginning of the path.
    (ex) If you have an image called logo.png in the public/images folder, you should use

    <img src="/images/logo.png" />
    

    in your code. Make sure your images are in the public folder and not in a subfolder like

    src/components/assets/media/images.
    
    Login or Signup to reply.
  2. Did you build the project before deploying:

    npm run build
    

    If so, try a hard refresh after deploying. The old images might be cached.

    On a Mac using Google Chrome…. open the inspector, then hold the control key then click the reload button then select "Hard Refresh". or just press Control + Command + R

    If you want a button for testing,

    Try the following:

    window.location.reload(true);
    

    If you are using Typescript and get an error, add the following before it like this:

    //@ts-ignore
    window.location.reload(true);
    

    You need true. Without it, it’s just a refresh. The browser won’t reload the cache from the server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search