The effect is shown below:

I. In the projectindex.htmlAdd in the same level directoryfavicon.icofile

Second, in the projectindex.htmlThe introduction of

<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico"  />

Three, configuration,webpackConfiguration files (under the Build folder)

Add the following two configuration files:

favicon: path.resolve('./favicon.ico')

Specific location:

1.webpack.dev.conf.js

new HtmlWebpackPlugin({ 
    filename: config.build.index, 
    template: 'index.html', 
    favicon: path.resolve('./favicon.ico'), 
    inject: true, 
}), 

2. webpack.prod.config.js

new HtmlWebpackPlugin({
      filename: process.env.NODE_ENV === 'testing'
        ? 'index.html'
        : config.build.index,
      template: 'index.html',
      favicon: path.resolve('./favicon.ico'),
      inject: true,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeAttributeQuotes: true
        // more options:
        // https://github.com/kangax/html-minifier#options-quick-reference
 })

Rerun the VUE project

    npm run dev