pts-vite-ssr-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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>

Readme

Keywords

Package Sidebar

Install

npm i pts-vite-ssr-plugin

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

7.51 kB

Total Files

16

Last publish

Collaborators

  • alexpts