Add Favicon with React and Webpack

前端 未结 14 2127
星月不相逢
星月不相逢 2020-12-12 19:46

I am attempting to add a favicon to a React-based website that I made using webpack. It has been a total nightmare to add a favicon and I have tried many solutions to no ava

相关标签:
14条回答
  • 2020-12-12 20:19

    Use the file-loader for that:

    {
        test: /\.(svg|png|gif|jpg|ico)$/,
        include: path.resolve(__dirname, path),
        use: {
            loader: 'file-loader',
            options: {
                context: 'src/assets',
                name: 'root[path][name].[ext]'
            }
        }
    }
    
    0 讨论(0)
  • 2020-12-12 20:19

    I will give simple steps to add favicon :-)

    • Create your logo and save as logo.png
    • Change logo.png to favicon.ico

      Note : when you save it is favicon.ico make sure it's not favicon.ico.png

    • It might take some time to update

      change icon size in manifest.json if you can't wait

    0 讨论(0)
提交回复
热议问题