repos
/ orchard main

orchard

mirror

Every site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.

blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics

802 B · 28 lines · JavaScript Raw History
 1import { resolve } from "path";
 2import { defineConfig } from "vite";
 3
 4// Vite builds a bundle and never serves anything. Go owns every request, in dev
 5// and in prod alike, and reads the manifest to resolve hashed filenames.
 6export default defineConfig({
 7  root: "static_src",
 8  base: "/static/",
 9  publicDir: resolve(__dirname, "public"),
10  build: {
11    outDir: resolve(__dirname, "../build/dist"),
12    emptyOutDir: true,
13    manifest: true,
14    rollupOptions: {
15      input: resolve(__dirname, "static_src/index.js"),
16      output: {
17        entryFileNames: "base-[hash].js",
18        assetFileNames: (assetInfo) => {
19          if (/\.css$/.test(assetInfo.name)) {
20            return "base-[hash].css";
21          }
22          return "assets/[name]-[hash][extname]";
23        },
24      },
25    },
26  },
27});