-
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: Hydration mismatch when using SSR #394
Comments
same here |
Also getting this issue! |
We'll take a look when we get a chance. |
As a workaround, you can force a icons to render client side only by wrapping it in another component. When this issue is fixed, you can just remove the <ClientOnly>
<FaIcon v-bind="$attrs" />
</ClientOnly> |
I second this: issue persists on the following package configuration:
|
I found this comment: nuxt/nuxt#16014 (comment) |
For me the hydration warnings was solved by an fix for an other problem i had: |
I can confirm this is still an issue with the latest version of nuxt and fontawesome pro |
The links above should fix the issue so let's have it clear here (instead of visiting another link): // nuxt.config.ts
build: {
transpile: [
'@fortawesome/fontawesome-svg-core',
'@fortawesome/pro-solid-svg-
'@fortawesome/pro-regular-svg-icons',
'@fortawesome/pro-light-svg-icons',
'@fortawesome/free-brands-svg-icons'
]
} However, I believe this is something doable with nuxt hooks in a nuxt-plugin. I started working on a nuxt module for This should just be documented on the installation with Nuxt section of FontAwesome. |
The transpile should include "@fortawesome/vue-fontawesome" too. At least on my side |
This is my nuxt.config.ts: build: { and the error is still there: [Vue warn]: Hydration node mismatch:
|
this fix my issue nuxt: 3.8.1 |
thanks alot |
still issue for laravel 10 with vite (inertiajs - vue3 - ssr) |
If you're curious, like I was, about why we need to transpile @fortawesome/vue-fontawesome in order to avoid this SSR hydration mismatch, it's because the module field in the package.json file from @fortawesome/vue-fontawesome specifies index.es.js as the entry point (link) but package.json doesn't specify The Nuxt documentation does an excellent job documenting this problem: https://nuxt.com/docs/guide/concepts/esm#what-kinds-of-problems-can-there-be So until @fortawesome/vue-fontawesome is updated to correct this issue, simply configure Nuxt to transpile @fortawesome/vue-fontawesome: build: {
transpile: [
'@fortawesome/vue-fontawesome',
],
}, |
See FortAwesome/vue-fontawesome#394 for the details of the workaround
I know that this is a Nuxt-related issue, but because it is so high up in search results, here's the equivalent configuration for plain Vite/SSR (tested with VuePress 2.0.0-rc.17, Vue 3.5.10 and Vite v5.4.8): export default defineConfig({
ssr: {
noExternal: ['@fortawesome/vue-fontawesome'],
},
}) |
Describe the bug
When using Nuxt 3 with the
<font-awesome-icon>
component while using SSR it causes a hydration node mismatch.Error:
Expected behavior
Using the component should not cause a node mismatch.
Desktop (please complete the following information):
Additional context
Wrapping the
<font-awesome-icon>
component with<client-only>
temporary fixes this issue.Package.json
The text was updated successfully, but these errors were encountered: