Files
opencode-manager/frontend/vite.config.ts
T
Chris Scott 3e617c2df8 fix: preserve prompt text on network error and allow offline typing (#276)
* fix: preserve prompt text on network error and allow offline typing

* fix: preserve prompt on network error, swallow 524 to avoid duplicate sends

* feat: add service worker precaching with app shell and runtime cache strategies

* fix: copy frontend/plugins into Docker build context

* fix: improve service worker update checks with visibility and focus handlers

* fix: add connect timeout to event stream to recover from failed connections

* fix: remove optimistic message insert, keep prompt in input until server confirms
2026-06-17 17:28:59 -04:00

63 lines
1.4 KiB
TypeScript

import path from "path";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { swPrecacheManifest } from "./plugins/sw-precache-manifest";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, path.resolve(__dirname, ".."), "");
const backendPort = env.PORT || 5001;
return {
envDir: path.resolve(__dirname, ".."),
plugins: [
react(),
tailwindcss(),
swPrecacheManifest(),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
host: "0.0.0.0",
port: 5173,
proxy: {
"/api": {
target: `http://localhost:${backendPort}`,
changeOrigin: true,
},
},
},
build: {
assetsInlineLimit: 4096,
rollupOptions: {
input: {
main: path.resolve(__dirname, "index.html"),
},
output: {
entryFileNames: "assets/[name]-[hash].js",
assetFileNames: (assetInfo) => {
if (assetInfo.name === "manifest.json") {
return "manifest.json";
}
return "assets/[name]-[hash][extname]";
},
},
},
},
preview: {
host: "0.0.0.0",
port: 5173,
},
worker: {
rollupOptions: {
output: {
entryFileNames: "sw.js",
},
},
},
};
});