Refactor as SSG using Vite+React
This commit is contained in:
parent
a22071815d
commit
6830bd41dd
25 changed files with 3076 additions and 282 deletions
22
src/entry-server.tsx
Normal file
22
src/entry-server.tsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Entry point for SSG
|
||||
import { renderToString } from "react-dom/server";
|
||||
import Body from "./Body";
|
||||
import Head from "./Head";
|
||||
import style from "./style.css?inline";
|
||||
|
||||
export const render = () => {
|
||||
const html =
|
||||
"<!doctype html>" +
|
||||
renderToString(
|
||||
<html lang="en">
|
||||
<head>
|
||||
<Head />
|
||||
<style type="text/css">{style}</style>
|
||||
</head>
|
||||
<body>
|
||||
<Body />
|
||||
</body>
|
||||
</html>,
|
||||
);
|
||||
return { html };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue