-
Notifications
You must be signed in to change notification settings - Fork 133
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 - Content duplicated by using font-awesome-icon #447
Comments
I'm also having this issue. As a temporary fix I've wrapped the icon with |
Hey all, I've been using antfu's unplugin-icons library which supports fontawesome icons. Until this issue is fixed, using unplugin-icons works super well (and honestly don't know whether I'll ever go back to |
I started using https://github.com/nuxt-modules/icon kinda embarrassing that a paid product pays no attention to simple issues like this. I'll probably not use it again. |
I think the build is broken. For me everything was working after I created a new component FontAwesomeIcon.vue with this content:
and installed the required "humps" dependency. |
I'm experiencing the same issue in Nuxt 3.4 (and was also experiencing it before I upgraded from Nuxt 3.0.0-rc4). It seems to only occur when the FontAwesomeIcon is placed inside of an
Despite these warnings, the icon does generate correctly on the client side. The solution by @mkoe-unitb is working as a fix for me (for both the duplication and all the related warning messages) |
Thank you, this fixed the Hydration mismatch error and the "Could not find one or more icons..." console error.
|
@jasonlundien Anything new on this issue ? |
I can confirm that the fix of creating a new component + installing humps works to remove the hydration warning. Hopefully, this will be fixed in the corresponding libraries (nuxt or fontawesome) |
I had the same issue and what worked for me is i wrapped the icon on its own div |
this is what worked |
How i use awesomefonts with vite + vue3
<script setup lang="ts">
import {config, dom, library} from "@fortawesome/fontawesome-svg-core";
import {fab} from '@fortawesome/free-brands-svg-icons';
import {far} from '@fortawesome/free-regular-svg-icons';
import {fas} from "@fortawesome/free-solid-svg-icons";
import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
config.autoAddCss = false; // prevent inlining mess with css in html head
library.add(fas, fab, far);
dom.watch();
</script>
<template>
</template>
<style> // <== Important, should be not scoped!
@import '@fortawesome/fontawesome-svg-core/styles.css';
</style> regular way: import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
<FontAwesomeIcon icon="fa-solid fa-rotate" size="4x"/> for menu: const items = computed(() => {
return <MenuItem[]>[
{
label: "Label",
icon: "fa-solid fa-rotate",
}, modern way: <i class="fa-solid fa-maximize fa-4x"/> |
This solves the issue too: #394 (comment) |
Thanks |
Describe the bug
When I used the
font-awesome-icon
tag, my page content is duplicated(in
app.vue
for example)My
layouts/default.vue
fileI used
fontawesome.js
pluginI import
'@fortawesome/fontawesome-svg-core/styles.css'
on thecss
property ofdefineNuxtconfig
And this into my
package.json
dependenciesI need to use Icon without duplicate 👎
Sorry I don't have codesandbox
It's on Chrome.
I used lodash, moment, primevue, tailwind, it's for a big starter project
Issue with
<font-awesome-icon />
If I remove the
<font-awesome-icon />
tag :It's duplicated only for the elements after the
<font-awesome-icon />
tagFor example, If my tag is on the end of my
app.vue
Nothing is duplicated
The text was updated successfully, but these errors were encountered: