-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.config.ts
More file actions
37 lines (32 loc) · 965 Bytes
/
Copy pathvite.config.ts
File metadata and controls
37 lines (32 loc) · 965 Bytes
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
import fs from 'node:fs'
import { defineConfig, type Plugin } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
import tsconfigPaths from 'vite-tsconfig-paths'
import { cloudflare } from "@cloudflare/vite-plugin";
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
const BUILD_HASH = process.env.CF_PAGES_COMMIT_SHA ?? Date.now().toString(36)
function versionFile(): Plugin {
return {
name: 'version-file',
buildStart() {
fs.writeFileSync('public/version.json', JSON.stringify({ hash: BUILD_HASH }))
},
}
}
const config = defineConfig({
server: {
allowedHosts: true,
},
plugins: [
versionFile(),
cloudflare({ viteEnvironment: { name: "ssr" } }),
devtools(),
tsconfigPaths({ projects: ['./tsconfig.json'] }),
tailwindcss(),
tanstackStart(),
viteReact(),
],
})
export default config