2026-05-08 08:36:03 +00:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
|
import path from 'node:path';
|
|
|
|
|
|
|
|
|
|
// Output goes to web/dist/ at the repo root so the Go binary can embed it
|
|
|
|
|
// via embed.FS without reaching outside the web/ tree.
|
|
|
|
|
const outDir = path.resolve(__dirname, '../web/dist');
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': path.resolve(__dirname, 'src'),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
build: {
|
|
|
|
|
outDir,
|
|
|
|
|
emptyOutDir: true,
|
|
|
|
|
sourcemap: true,
|
|
|
|
|
target: 'es2020',
|
|
|
|
|
// Multiple HTML entries — one per legacy page we migrate.
|
|
|
|
|
// As pages get ported in later phases, add their entrypoints here.
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
input: {
|
|
|
|
|
index: path.resolve(__dirname, 'index.html'),
|
2026-05-08 09:04:20 +00:00
|
|
|
login: path.resolve(__dirname, 'login.html'),
|
2026-05-08 08:36:03 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
strictPort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
// Proxy API calls during `npm run dev` to the local Go panel.
|
2026-05-08 09:55:40 +00:00
|
|
|
// Patterns are anchored regex so /login.html and /index.html
|
|
|
|
|
// (which Vite serves itself) are NOT forwarded — only the bare
|
|
|
|
|
// backend paths and their sub-routes.
|
|
|
|
|
'^/(login|logout|getTwoFactorEnable)$': 'http://localhost:2053',
|
|
|
|
|
'^/(panel|server)(/|$)': 'http://localhost:2053',
|
2026-05-08 08:36:03 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|