From 93ce53394fe9d0f479870278b3e02ef9338d92e5 Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 25 Jul 2025 22:03:25 +0800 Subject: [PATCH] Add no-cache headers to index.html via custom Vite plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Create noCachePlugin for Vite • Add cache-control meta tags • Inject headers into index.html • Prevent browser caching issues --- lightrag_webui/vite.config.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lightrag_webui/vite.config.ts b/lightrag_webui/vite.config.ts index 084f09e0..5381a870 100644 --- a/lightrag_webui/vite.config.ts +++ b/lightrag_webui/vite.config.ts @@ -4,9 +4,21 @@ import { webuiPrefix } from '@/lib/constants' import react from '@vitejs/plugin-react-swc' import tailwindcss from '@tailwindcss/vite' +// A custom Vite plugin to add cache-control headers to index.html +const noCachePlugin = () => ({ + name: 'no-cache', + transformIndexHtml(html: string) { + const cacheControlMeta = ` + + + `; + return html.replace('', `${cacheControlMeta}\n`); + }, +}); + // https://vite.dev/config/ export default defineConfig({ - plugins: [react(), tailwindcss()], + plugins: [react(), tailwindcss(), noCachePlugin()], resolve: { alias: { '@': path.resolve(__dirname, './src')