0

In my Vue js app, image is loading on my localhost environment form "src/assets" folder but when i deploy it on firebase images are not showing .404 is showing . what the problem here?

i am using: 
<img src="../assets/logo.png" style="width:100%" alt="Avatar">:
i also tried:
 "<img :src="../assets/logo.png" style="width:100%" alt="Avatar">"

6
  • 1
    Are you using some module bundler like webpack? Commented May 7, 2018 at 18:39
  • yes i am using webpack Commented May 8, 2018 at 17:16
  • Take a look to this folder structure dzwonsemrish7.cloudfront.net/items/0p200P3Q3L0W390S2441/…, then if you are calling your image from app.vue you should call load it like this: <img src="./assets/logo.png" style="width:100%" alt="Avatar"> and that should work. Commented May 8, 2018 at 17:52
  • Did you make it work? Commented May 10, 2018 at 5:44
  • YES i fix it by using the full path "src/assets/logo.png" Commented May 10, 2018 at 16:36

1 Answer 1

2

Try to give the full path instead of ../assets/logo.png try src/assets/logo.png or what ever It should be complete full path.

Sign up to request clarification or add additional context in comments.

2 Comments

I don't think this is a webpack issue. Give exact same path to the alt attribute and see what it gives. (<img src="src/assets/logo.png" style="width:100%" alt="src/assets/logo.png">). I think you have a path issue. If alt prints it correct and logo.png exists in that path image should appear in the screen.
src/assets/logo.png didn't work for me. But @/assets/logo.png did!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.