question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inject with HtmlWebpackPlugin

See original GitHub issue

Question: Is there something that needs to be set up to make automatic injection work? I see that the icon folder is generated but the injections doesnt work. Here the plugin part of my webpack config.

...
plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new FaviconsWebpackPlugin({
        logo: path.resolve(__dirname, 'dist/images/nova.png'),
        inject: true
    }),
    new HtmlWebpackPlugin({
      filename: indexHtmlName,
      template: 'public/index.html',
      inject: 'head',
      hash: true
    })
  ]
...

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jantimoncommented, Jan 15, 2020

@Konafets by default during development the FaviconsWebpackPlugin will not generate all logos to keep your webpack bootup time as fast as possible.

For production build you should see more favicons generated.

If you need all favicons already during development you can set the mode to webapp:

new FaviconsWebpackPlugin({
    logo: './src/logo.png', // svg works too
    devMode: 'webapp', // optional can be 'webapp' or 'light' - 'light' by default 
})
2reactions
brunokcommented, Jan 15, 2020

I had the same problem. Got it resolved by setting the inject property of HtmlWebpackPlugin to true.

new HtmlWebpackPlugin({
  inject: true,
  ...,
  ...,
})

I am using favicons-webpack-plugin 3.x with html-webpack-plugin 4.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

inject-html-webpack-plugin - npm
inspired by html-webpack-plugin,simple and efficient Webpack plugin that inject script label and style links into your html ...
Read more >
HtmlWebpackPlugin - inject js in body at a specifc place
I am using HtmlWebpackPlugin to inject javascript into my ...
Read more >
HtmlWebpackPlugin | webpack
The HtmlWebpackPlugin simplifies creation of HTML files to serve your webpack bundles. ... Add the plugin to your webpack configuration as follows:
Read more >
Inject a JavaScript bundle into HTML with the ... - Egghead.io
In this lesson, we'll see how to use the HtmlWebpackPlugin to inject the script tag for our bundle into an HTML template file....
Read more >
inject-html-webpack-plugin - npm package - Snyk
The npm package inject-html-webpack-plugin receives a total of 3,441 weekly downloads. As such, inject-html-webpack-plugin popularity was classified as small.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found