import { createCache, extractStyle } from "ant-design-vue"; /** * Ant Design Vue uses CSS-in-JS. During SSR/SSG we collect the generated styles into a cache * and inline them into , so prerendered HTML is fully styled before hydration (no FOUC). */ export default defineNuxtPlugin((nuxtApp) => { const cache = createCache(); if (import.meta.server) { nuxtApp.hook("app:rendered", ({ ssrContext }) => { const css = extractStyle(cache, true); if (css && ssrContext) { ssrContext.head.push({ style: [{ key: "antd-cssinjs", innerHTML: css }], }); } }); } return { provide: { antdCache: cache } }; });