I’m trying to implement Storybook into my project and I can’t seem to figure out how to change the Favicon. I’m using version 8.2.9 and I can’t find any relevant information online. I don’t have a manager-head.html file and I’ve tried things like
In my manager.ts file
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('link[rel="shortcut icon"]')?.setAttribute('href', favicon);
});
and also this in my main.ts file
config.plugins?.push(
new HtmlWebpackPlugin({
title: 'Title',
favicon: './public/favicon.png',
})
);
Does anyone know how to do this?
2
Answers
Many of the other solutions weren't working or only worked sometimes so this is the fix that helped me. In my main.ts file I added this to the configs.
You can try create a manager-head.html in the Storybook configuration directory (usually .storybook/), and add the following content:
Another way: Using manager.ts/manager.js: