Why does <font-awesome-icon /> output whatever follows twice when using Nuxt v3 static generation?

Viewed 90

I am using vue-fontawesome 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.

You can grab the generated site from here as a reproducible test case. https://andreafranceschini.org/files/afnuxt.tgz

I hear vue-fontawesome isn't super happy with SSR and static generation, but I also see others using it just fine in the same way so I wonder what I may be doing wrong?

EDIT I also posted this as a "bug" here.

EDIT 2 A workaround is to enclose the icon alone in something else, like a span tag.

1 Answers

I found a workaround, which is to enclose the icon alone in something else, like a span tag.

Related