2023-10-21 20:30:47 +01:00
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
2023-11-08 20:38:40 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import pluginRewriteAll from 'vite-plugin-rewrite-all'
|
|
|
|
import svgLoader from 'vite-svg-loader'
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
|
|
|
|
// Development mode:
|
|
|
|
// npm run dev # Run frontend that proxies to dev_backend
|
|
|
|
// cista -l :8000 --dev # Run backend
|
|
|
|
const dev_backend = {
|
|
|
|
target: "http://localhost:8000",
|
|
|
|
changeOrigin: false, // Use frontend "host" to match "origin" from browser
|
|
|
|
ws: true,
|
|
|
|
}
|
|
|
|
|
2023-10-21 20:30:47 +01:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
2023-11-08 20:38:40 +00:00
|
|
|
pluginRewriteAll(),
|
|
|
|
svgLoader(), // import svg files
|
|
|
|
Components(), // auto import components
|
2023-10-21 20:30:47 +01:00
|
|
|
],
|
2023-11-08 20:38:40 +00:00
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
less: {
|
|
|
|
modifyVars: {},
|
|
|
|
javascriptEnabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-10-21 20:30:47 +01:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
|
|
|
},
|
2023-11-08 20:38:40 +00:00
|
|
|
server: {
|
|
|
|
proxy: {
|
|
|
|
"/api": dev_backend,
|
|
|
|
"/files": dev_backend,
|
|
|
|
"/login": dev_backend,
|
|
|
|
"/logout": dev_backend,
|
|
|
|
"/zip": dev_backend,
|
2023-11-18 19:38:25 +00:00
|
|
|
"/preview": dev_backend,
|
2023-11-08 20:38:40 +00:00
|
|
|
}
|
|
|
|
},
|
2023-10-21 20:30:47 +01:00
|
|
|
build: {
|
|
|
|
outDir: "../cista/wwwroot",
|
|
|
|
emptyOutDir: true,
|
|
|
|
}
|
|
|
|
})
|