I am using the Vue CLI webpack template, but struggling to load my own favicon.
I have run vue init webpack my-app
In index.html
I have included:
<link rel="shortcut icon" href="<%= webpackConfig.output.publicPath %>favicon.ico">
... and I DO see the default (Vue) favicon. However, I cannot work out where that favicon is located (or otherwise referenced), nor can I figure out where to place my own favicon, to replace it.
I have also followed the advice in this answer, which suggests placing the favicon image in the static
folder and including this in index.html
:
<link rel="shortcut icon" type="image/png" href="/static/favicon.png"/>
However, I do not have access to my favicon, as promised.
My guess is that the favicon location / file is referenced somewhere in the CLI config files, but I cannot find it.
Changing favicon 1 Open the vue app in your favorite code editor. 2 Navigate to the public folder and remove the favicon.ico file. 3 Now, add a new favicon inside the public folder. More ...
Note: The favicon filename should be favicon.ico. Reload your app to see the new favicon.
If we click on the Change icon button, the handleIcon () method is invoked and the current favicon is changed to Google's favicon.
<link href='./img/favicon.png' rel="icon" Atype="image/x-icon" /> Or you can just add it directly in the public or dist (where the project is built) directory, as it is and remove the favicon tag of your index.html. If it doesn't work, then you might have to look webpack config ...
I have the same problem:
I checked the index.html and the link created shows an absolute link address for a favicon icon:
<link rel=icon href=/favicon.ico><title>
After I changed the address from "/" to "./" it worked, and my favicon was shown. I could imagine there is a configuration option hidden somewhere in the config jungle, which I did not find yet ;-)
If anybody has an idea how to get vue to build a correct final (and if possible: debug) version, would be great!
You may also need to update the manifest for the favicons as well: /public/manifest.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With