Skip to content

Commit 76b5d49

Browse files
committed
Update ssr package - Vike
1 parent 90a84a1 commit 76b5d49

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

templates/ssr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"devDependencies": {
1414
"@preact/preset-vite": "^2.5.0",
1515
"vite": "^4.3.2",
16-
"vite-plugin-ssr": "^0.4.133"
16+
"vike": "^0.4.143"
1717
}
1818
}

templates/ssr/renderer/_default.page.client.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export { render };
33
import { hydrate } from 'preact';
44
import { PageShell } from './PageShell';
55

6-
// This render() hook only supports SSR, see https://vite-plugin-ssr.com/render-modes for how to modify render() to support SPA
6+
// This render() hook only supports SSR, see https://vike.dev/render-modes for how to modify render() to support SPA
77
async function render(pageContext) {
88
const { Page, pageProps } = pageContext;
99
if (!Page) throw new Error('Client-side render() hook expects pageContext.Page to be defined');
@@ -20,4 +20,4 @@ async function render(pageContext) {
2020

2121
/* To enable Client-side Routing:
2222
export const clientRouting = true
23-
// !! WARNING !! Before doing so, read https://vite-plugin-ssr.com/clientRouting */
23+
// !! WARNING !! Before doing so, read https://vike.dev/clientRouting */

templates/ssr/renderer/_default.page.server.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
export { render };
2-
// See https://vite-plugin-ssr.com/data-fetching
2+
// See https://vike.dev/data-fetching
33
export const passToClient = ['pageProps', 'urlPathname'];
44

55
import { renderToString } from 'preact-render-to-string';
66
import { PageShell } from './PageShell';
7-
import { escapeInject, dangerouslySkipEscape } from 'vite-plugin-ssr/server';
7+
import { escapeInject, dangerouslySkipEscape } from 'vike/server';
88

99
async function render(pageContext) {
1010
const { Page, pageProps } = pageContext;
11-
// This render() hook only supports SSR, see https://vite-plugin-ssr.com/render-modes for how to modify render() to support SPA
11+
// This render() hook only supports SSR, see https://vike.dev/render-modes for how to modify render() to support SPA
1212
if (!Page) throw new Error('My render() hook expects pageContext.Page to be defined');
1313
const pageHtml = renderToString(
1414
<PageShell pageContext={pageContext}>
1515
<Page {...pageProps} />
1616
</PageShell>,
1717
);
1818

19-
// See https://vite-plugin-ssr.com/head
19+
// See https://vike.dev/head
2020
const { documentProps } = pageContext.exports;
2121
const title = (documentProps && documentProps.title) || 'Vite SSR + Preact';
2222
const desc =
23-
(documentProps && documentProps.description) || 'Preact app with Vite and vite-plugin-ssr';
23+
(documentProps && documentProps.description) || 'Preact app with Vite and vike';
2424

2525
const documentHtml = escapeInject`<!DOCTYPE html>
2626
<html lang="en">
@@ -40,7 +40,7 @@ async function render(pageContext) {
4040
return {
4141
documentHtml,
4242
pageContext: {
43-
// We can add some `pageContext` here, which is useful if we want to do page redirection https://vite-plugin-ssr.com/page-redirection
43+
// We can add some `pageContext` here, which is useful if we want to do page redirection https://vike.dev/page-redirection
4444
},
4545
};
4646
}

templates/ssr/renderer/usePageContext.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// `usePageContext` allows us to access `pageContext` in any Preact component.
2-
// See https://vite-plugin-ssr.com/pageContext-anywhere
2+
// See https://vike.dev/pageContext-anywhere
33

44
import { createContext } from 'preact';
55
import { useContext } from 'preact/hooks';

templates/ssr/vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite';
22
import preact from '@preact/preset-vite';
3-
import ssr from 'vite-plugin-ssr/plugin';
3+
import ssr from 'vike/plugin';
44

55
// https://vitejs.dev/config/
66
export default defineConfig({

0 commit comments

Comments
 (0)