Skip to content

Commit

Permalink
fix: Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frandiox committed Feb 10, 2021
1 parent 8aa691a commit dcfda90
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

const build = require('vite-ssr/build')
const build = require('./build')

const [, , ...args] = process.argv

Expand Down
5 changes: 3 additions & 2 deletions core/entry-server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createSSRApp } from 'vue'
import renderer from '@vue/server-renderer'
import { renderToString } from '@vue/server-renderer'
import { createRouter, createMemoryHistory } from 'vue-router'
import { createUrl, getFullPath, withoutSuffix } from './utils'

export default function (App, { routes, base }, hook) {
return async function ({ request, ...extra }) {
const url = createUrl(request.url)
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function (App, { routes, base }, hook) {
router.currentRoute.value.meta.state || {}
)

let html = await renderer.renderToString(app)
let html = await renderToString(app)

const [helmet = ''] = html.match(/<html[^>]*?>(.|\s)*?<\/html>/im) || []
let [, head = ''] = helmet.match(/<head[^>]*?>((.|\s)*?)<\/head>/im) || []
Expand Down
10 changes: 4 additions & 6 deletions example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
<h1>A small state test for rehydration: {{ count }}</h1>
<button @click="count++">Add to count</button>
<nav>
<router-link to="/">Go to Home</router-link>
<router-link to="/a">Go to A</router-link>
<router-link to="/b">Go to B</router-link>
<RouterLink to="/">Go to Home</RouterLink>
<RouterLink to="/a">Go to A</RouterLink>
<RouterLink to="/b">Go to B</RouterLink>
</nav>
<h1>Below is the currently rendered route:</h1>
<router-view v-slot="{ Component }">
<component :is="Component" />
</router-view>
<RouterView />
</template>

<script>
Expand Down
1 change: 1 addition & 0 deletions example/src/pages/PageB.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
name: 'PageB',
props: {
msg: String,
server: Boolean,
},
}
</script>

0 comments on commit dcfda90

Please sign in to comment.