@vercube/nuxt-lazy-hydration
Version:
Optimize Vue 3 SSR with lazy hydration, delaying HTML hydration until it's needed for better performance
27 lines (24 loc) • 619 B
JavaScript
import { defineNuxtModule, addComponent, addImportsSources } from '@nuxt/kit';
var index = defineNuxtModule({
meta: {
name: 'nuxt-lazy-hydrate',
configKey: 'lazyHydrate',
compatibility: {
nuxt: '>=3.0.0'
}
},
setup() {
// Register the component globally
addComponent({
name: 'NuxtLazyHydrate',
export: 'LazyHydration',
filePath: '@vercube/vue-lazy-hydration'
});
// Add the composable to the global imports
addImportsSources({
imports: ['useLazyHydration'],
from: '@vercube/vue-lazy-hydration'
});
}
});
export { index as default };