27 lines
708 B
JavaScript
27 lines
708 B
JavaScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const backend = 'http://127.0.0.1:8765';
|
|
const proxy = () => ({
|
|
target: backend,
|
|
// Keep Host and Origin paired; never rewrite an untrusted browser Origin.
|
|
changeOrigin: false,
|
|
});
|
|
|
|
export default defineConfig({
|
|
base: './',
|
|
plugins: [vue()],
|
|
build: {
|
|
outDir: '../ranch_web/static/console',
|
|
emptyOutDir: true,
|
|
sourcemap: false,
|
|
},
|
|
server: {
|
|
fs: {
|
|
allow: [fileURLToPath(new URL('.', import.meta.url)), fileURLToPath(new URL('../ranch_web/static', import.meta.url))],
|
|
},
|
|
proxy: { '/api': proxy(), '/login': proxy(), '/static': proxy() },
|
|
},
|
|
});
|