Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Nuxt 3 "generate" results in <font-awesome-icon /> to output whatever follows twice #384

Open
Morpheu5 opened this issue Aug 7, 2022 · 9 comments

Comments

@Morpheu5
Copy link

Morpheu5 commented Aug 7, 2022

Describe the bug
I am using this component with Nuxt 3 as described here and I'm seeing this weird behaviour. Say I have something like this

<a href="https://example.com"><font-awesome-icon icon="fa-brands fa-twitter" />Example</a>

if I run the dev server, everything is fine, but if I run generate and serve the output through a static HTTP server, I get "Example" printed twice. If I wrap the text in a tag, I get the tag and text twice (i.e. <span>Example</span><span>Example</span>). Weirdly enough, though, the generated HTML does not contain the repetition, so I suspect something weird is going on in the browser.

Reproducible test case
https://andreafranceschini.org/files/afnuxt.tgz

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • Happens on all browsers
@Morpheu5
Copy link
Author

Morpheu5 commented Aug 8, 2022

I found a workaround, which is to enclose the font-awesome-icon component in a dummy tag like a span, in that case I get no duplication (no visible duplication, at least).

@ricky11
Copy link

ricky11 commented Oct 2, 2022

Same issue, wrapping it in a span is a short term solution. fa pro team pls address this, we're paying customers.

@robmadole
Copy link
Member

Have you tried avoiding self-closing tags?

<a href="https://example.com"><font-awesome-icon icon="fa-brands fa-twitter"></font-awesome-icon>Example</a>

And I cannot download your reproduction. Can you check that please?

@ricky11
Copy link

ricky11 commented Oct 5, 2022

Have you tried avoiding self-closing tags?

<a href="https://example.com"><font-awesome-icon icon="fa-brands fa-twitter"></font-awesome-icon>Example</a>

And I cannot download your reproduction. Can you check that please?

For me i have to do something like this to make sure text to the right of it is not displayed twice.
Using nuxt3

seems quite inconvenient and hacky to do so.

@Reaper88
Copy link

Reaper88 commented Dec 5, 2022

I am having the same issue and also gettings alot of logs like this from nuxt server side and also wrapping it doesn't do any good to me.

Could not find one or more icon(s) { prefix: 'fas', iconName: 'server' } {} 

@corybagozzi
Copy link

corybagozzi commented Dec 13, 2022

I am having the same issue and also gettings alot of logs like this from nuxt server side and also wrapping it doesn't do any good to me.

Could not find one or more icon(s) { prefix: 'fas', iconName: 'server' } {} 

I am having this same issue. Getting the log error like this one but the icon is working on local and when deployed to Vercel.

Wrapping in a Span did fix the doubling problem for whatever came after the icon.

@antoinezanardi
Copy link

Any update on this please ?

@ricky11
Copy link

ricky11 commented Dec 23, 2022

wrap it in a span is the current hacky solution.

@CallumWatkins
Copy link

I've posted a possible solution to this issue on Stack Overflow: https://stackoverflow.com/a/74999711/4415734

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

No branches or pull requests

7 participants