Uh oh!
There was an error while loading. Please reload this page.
feat(components): .client.vue / .server.vue convention - #1919
Conversation
✔️ Deploy Preview for nuxt3-docs canceled. 🔨 Explore the source changes: 399f944 🔍 Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/6232552869a46b0008f21714 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
.client.vue / .server.vue conventionpi0
commented
Nov 17, 2021
Hi @antfu do you mind to fix merge conflicts? |
For the bundle optimization, for now, I can see two ways of doing it:
Do you have any idea on them? Thanks |
pi0
commented
Nov 22, 2021
Some improvement suggestions:
|
antfu
commented
Dec 2, 2021
My initial idea is that
I'd love to, but I guess that's more like the initial approach that we faced the hydration errors - and that's why we introduced the |
Guess what, I made it work! 🚀d093fa9 - Pushed to this branch |
andysay
commented
Dec 11, 2021
hello, when it will be merged?? |
Uh oh!
There was an error while loading. Please reload this page.
Marked as draft Global mode probably won't work due to the latest refactor of how components been resolved. Working with @danielroe on this. |
antfu
commented
Mar 10, 2022
Resolved :) |
atinux
commented
Mar 31, 2022
New conflicts again 😅 What do we do about this PR? If agree, I think next step if to update the docs in https://v3.nuxtjs.org/docs/directory-structure/components#clientonly-component in order to merge. |
pi0
commented
Mar 31, 2022
I think will finally have to rework this PR. Idea is nice but implementation needs to be revised with simpler component options. |
Thank you again @antfu for working on this. Since PR is stalled with conflicts and I expect a simpler interface for implementation, let's track this via nuxt/nuxt#11884. We are also closer with nitro to support server-only components 🤞🏼 |

🔗 Linked issue
nuxt/nuxt#11884
Continues from #1853
❓ Type of change
📚 Description
This PR bring
.client.vueand.server.vueconversion for components directly. This PR is focus on.client.vueclient only components with optional.server.vueas SSR fallback. Server-only components will be left to future PRs.How it works
When we do the component scanning, components with suffixes will be treated as one component entry with two file paths. Then we create a virtual component using templates with the wrapper by
<ClientOnly>. This way we could use the component as normal but be able to do environment-specific logic.Progress
.server.vueand.client.vue📝 Checklist