56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { execSync } from "node:child_process"
|
|
import { readFileSync } from "node:fs"
|
|
import tailwindcss from "@tailwindcss/vite"
|
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite"
|
|
import react from "@vitejs/plugin-react"
|
|
import { defineConfig } from "vite"
|
|
import { VitePWA } from "vite-plugin-pwa"
|
|
|
|
const pkg = JSON.parse(readFileSync("./package.json", "utf-8"))
|
|
const gitCount = execSync("git rev-list --count HEAD", { encoding: "utf-8" }).trim()
|
|
|
|
export default defineConfig({
|
|
base: "/whattoplay/",
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(`${pkg.version}+${gitCount}`),
|
|
},
|
|
plugins: [
|
|
TanStackRouterVite(),
|
|
react(),
|
|
tailwindcss(),
|
|
VitePWA({
|
|
registerType: "prompt",
|
|
manifest: {
|
|
name: "WhatToPlay",
|
|
short_name: "WhatToPlay",
|
|
description: "Manage your game library across platforms",
|
|
theme_color: "#0f172a",
|
|
background_color: "#0f172a",
|
|
display: "standalone",
|
|
icons: [
|
|
{ src: "icons/icon-192.png", sizes: "192x192", type: "image/png" },
|
|
{ src: "icons/icon-512.png", sizes: "512x512", type: "image/png" },
|
|
],
|
|
},
|
|
workbox: {
|
|
globPatterns: ["**/*.{js,css,html,ico,png,svg,wasm,data}"],
|
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": "/src",
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/whattoplay/api": {
|
|
target: "http://localhost:3001",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/whattoplay\/api/, ""),
|
|
},
|
|
},
|
|
},
|
|
})
|