Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot destructure property tagName of 'undefined' or 'null' #260

Closed
in-in opened this issue Feb 23, 2021 · 5 comments · Fixed by #261
Closed

Cannot destructure property tagName of 'undefined' or 'null' #260

in-in opened this issue Feb 23, 2021 · 5 comments · Fixed by #261

Comments

@in-in
Copy link

in-in commented Feb 23, 2021

Current behaviour 💣

I get the error when I build my project

TypeError: Cannot destructure property `tagName` of 'undefined' or 'null'  

210541614095064

Expected behaviour ☀️

It should be built without any errors.

I want to fine-tune which icons to use in the project.

favicons: [
  "favicon-16x16.png",
  "favicon.ico"
]

But it doesn't work if I remove the default elements from the array. Or it only works with the inject: false option.

Reproduction Example 👾

https://codesandbox.io/s/tender-jones-obesr?file=/webpack.config.js

Environment 🖥

Node.js v10.23.0
linux 5.4.0-40-generic
+-- favicons@6.2.1
+-- favicons-webpack-plugin@5.0.1
| `-- html-webpack-plugin@5.2.0  deduped
+-- html-webpack-plugin@5.2.0
+-- webpack@5.24.0
`-- webpack-cli@4.5.0
@jantimon
Copy link
Owner

Oh favicons generates the following html tags:

[
  '<link rel="shortcut icon" href="favicon.ico">',
  '<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">',
  '',
  '',
  '<link rel="manifest" href="manifest.json">',
  '<meta name="mobile-web-app-capable" content="yes">',
  '<meta name="theme-color" content="#fff">',
  '<meta name="application-name" content="favicon">'
]

so I guess it's a bug on their side to generate empty strings...
but it would be easy to add a small filter :)

@jantimon
Copy link
Owner

Thanks a lot for reporting the issue

I'll release the fix from #261 soon :)

Maybe you can ask in the favicons repository why it generates empty strings in the tags array.

@jantimon
Copy link
Owner

Released in favicons-webpack-plugin@5.0.2

@code1x1
Copy link

code1x1 commented Mar 30, 2021

could you backport the bugfix to favicons-webpack-plugin@4
@jantimon

@tomasztomys
Copy link

tomasztomys commented Jul 16, 2021

please backport the bugfix also for 4.x

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants