Reputation:
I am trying to add an image , in one of the Vue app , i am using "./assets/logo.png"
the url of Vue app is http://localhost:8080/#/
What can be the cause of the error ?
Answers Appreciated
Upvotes: 0
Views: 1055
Reputation: 8368
For this to work you need to require the image source, add an extra .
at the start so you go out of the components
folder, and include .png
on the end of it:
{ ... image: require("../assets/logo.png") }
The require is something to do with webpack not knowing where you're referring to without it.
Upvotes: 1
Reputation: 3616
Change "./assets/logo.png"
to require('../assets/logo.png')
This tells Webpack to search for that image at that location and replace the reference with an actual value at render time.
Upvotes: 0