pts-vite-ssr-plugin
v0.0.3
Published
Helpers for SSR
Downloads
2
Readme
pts-vite-ssr-plugin
Problem: re-initializing a component in the browser and requesting data that was already received when the component was rendered on the server
Plugin provide init methods for invoke only SSR / only browser. Plugin prevent re-initializing first state on browser.
Examples
<script setup>
import { useStore } from 'vuex'
import { init, initBrowser, initSSR } from 'pts-vue-ssr-plugin'
const store = useStore()
init(async() => {
console.log('SSR and browser, will skip in browser hydrate if invoke in SSR');
}, {store});
initBrowser(async() => {
console.log('browser only')
})
initSSR(async () => {
console.log('SSR only');
})
</script>