Search Docs
string | Function
undefined
设置页面的 favicon 图标,可以设置为:
配置该选项后,在编译过程中会自动将图标拷贝至 dist 目录下,并在 HTML 中添加相应的 link 标签。
link
设置为相对路径:
export default { html: { favicon: './src/assets/icon.png', }, };
设置为绝对路径:
import path from 'path'; export default { html: { favicon: path.resolve(__dirname, './src/assets/icon.png'), }, };
设置为 URL:
import path from 'path'; export default { html: { favicon: 'https://foo.com/favicon.ico', }, };
重新编译后,HTML 中自动生成了以下标签:
<link rel="icon" href="/favicon.ico" />
详细用法可参考 Rsbuild - html.favicon。