import {defineConfig} from 'vite' import vue from '@vitejs/plugin-vue' import {readdirSync,readFileSync} from 'node:fs' import {createHash} from 'node:crypto' const hash=createHash('sha256') for(const name of readdirSync('../web').filter(n=>n.endsWith('.js')).sort())hash.update(name).update(readFileSync('../web/'+name)) export default defineConfig({define:{__LEGACY_REVISION__:JSON.stringify(hash.digest('hex').slice(0,16))},plugins:[vue({template:{transformAssetUrls:false}})],base:'/ui/',build:{target:'es2018',outDir:'../web/ui',emptyOutDir:true,assetsDir:'assets',rollupOptions:{input:{index:'index.html',tv:'tv.html'}}}})