vue-fontawesome icon indicating copy to clipboard operation
vue-fontawesome copied to clipboard

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

Open Morpheu5 opened this issue 2 years ago • 9 comments

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 avatar Aug 07 '22 19:08 Morpheu5

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).

Morpheu5 avatar Aug 08 '22 08:08 Morpheu5

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

ricky11 avatar Oct 02 '22 02:10 ricky11

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?

robmadole avatar Oct 03 '22 14:10 robmadole

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.

ricky11 avatar Oct 05 '22 01:10 ricky11

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' } {} 

Reaper88 avatar Dec 05 '22 10:12 Reaper88

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.

corybagozzi avatar Dec 13 '22 20:12 corybagozzi

Any update on this please ?

antoinezanardi avatar Dec 22 '22 17:12 antoinezanardi

wrap it in a span is the current hacky solution.

ricky11 avatar Dec 23 '22 03:12 ricky11

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

CallumWatkins avatar Jan 03 '23 23:01 CallumWatkins