-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
54 lines (53 loc) · 1.54 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { createApp } from "vinxi";
import path from 'path';
// @ts-expect-error no type defs
import { serverFunctions } from "@vinxi/server-functions/plugin";
import { MyFileSystemRouter } from "./src/router";
export default createApp({
server: {
preset: 'vercel'
},
routers: [
{
name: "public",
type: "static",
dir: "./public",
},
{
name: "ssr",
type: "http",
handler: "./src/entry-server.tsx",
target: "server",
middleware: "./src/middleware.ts",
routes: (router, app) => {
return new MyFileSystemRouter(
{
dir: path.join(__dirname, "src/routes"),
extensions: ["jsx", "js", "tsx", "ts"],
},
router,
app
)
}
},
{
name: "client",
type: "client",
handler: "./src/entry-client.tsx",
target: "browser",
base: "/_build",
routes: (router, app) => {
return new MyFileSystemRouter(
{
dir: path.join(__dirname, "src/routes"),
extensions: ["jsx", "js", "tsx", "ts"],
},
router,
app
)
},
plugins: () => [serverFunctions.client()],
},
serverFunctions.router(),
],
});