antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite
MIT License
1.3k stars 134 forks source link

`createSSRApp()` should be called in client mode #410

Open infinnie opened 1 month ago

infinnie commented 1 month ago

Describe the bug

The documentation on createSSRApp() says, (https://vuejs.org/api/application.html#createssrapp )

Creates an application instance in SSR Hydration mode. Usage is exactly the same as createApp().

And its demo code is like

// this runs in the browser.
import { createSSRApp } from 'vue'

const app = createSSRApp({
  // ...same app as on server
})

// mounting an SSR app on the client assumes
// the HTML was pre-rendered and will perform
// hydration instead of mounting new DOM nodes.
app.mount('#app')

Reproduction

https://github.com/antfu-collective/vite-ssg/blob/26e1e07536b9d2c0e7370f3d0fdd3ff89b04e126/src/client/index.ts#L29

System Info

n/a

Used Package Manager

npm

Validations

Contributions

Shyam-Chen commented 1 month ago

async function createApp(client = false, routePath?: string) {

client has a default parameter set to false.