Search code examples
webpackfavicon

How to make Favicons Webpack Plugin not add an initial slash to assets directory


I am using Favicons Webpack Plugin to have the favicons in my site.

I have tried several ways but I cannot get the slash removed of the href directory.

I need href="assets/favicon-16x16.png" instead of href="/assets/favicon-16x16.png"

I tried this answer https://stackoverflow.com/a/43191900/3808307 and it still adds the slash

I also tried

plugins: [
  new FaviconsWebpackPlugin({   
    logo: '/path/to/logo.png',
    publicPath: '/',

})]

and

plugins: [
  new FaviconsWebpackPlugin({   
    logo: '/path/to/logo.png',
    publicPath: '',

})]

and outputPath: '' instead of publicPath: ''

and I cannot get rid of the slash.

Thank you


Solution

  • I solved this problem

    plugins: [
      new FaviconsWebpackPlugin({   
        logo: '/path/to/logo.png',
        publicPath: '.',
    })]