-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
55 lines (52 loc) · 1.52 KB
/
vite.config.ts
File metadata and controls
55 lines (52 loc) · 1.52 KB
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
55
import build from '@hono/vite-cloudflare-pages'
import devServer from '@hono/vite-dev-server'
import adapter from '@hono/vite-dev-server/cloudflare'
import { defineConfig } from 'vite'
export default defineConfig((config) => {
if(config.mode.includes("pages")) {
return {
server: {
host: import.meta.env.VITE_HOST ?? "localhost",
port: parseInt(import.meta.env.VITE_PORT ?? "3000")
},
plugins: [
build({
outputDir: 'dist/pages'
}),
devServer({
adapter,
entry: 'src/index.tsx'
})
]
}
}
if(config.mode.includes("bun")) {
return {
server: {
host: import.meta.env.VITE_HOST ?? "localhost",
port: parseInt(import.meta.env.VITE_PORT ?? "3000")
},
build: {
ssr: true,
minify: false,
target: "esnext",
rollupOptions: {
input: {
main: "src/index.tsx"
},
output: {
entryFileNames: 'server.js',
format: 'esm'
}
},
outDir: "dist/bun"
},
plugins: [
devServer({
entry: 'src/index.tsx'
})
]
}
}
return {}
})