WGDashboard/src/static/app/vite.config.js

66 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-01-08 12:23:57 -05:00
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import {proxy} from "./proxy.js";
2024-01-08 12:23:57 -05:00
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
2024-08-10 00:25:25 -04:00
export default defineConfig(({mode}) => {
2024-08-10 19:03:21 -04:00
if (mode === 'electron'){
2024-08-10 00:25:25 -04:00
return {
2024-08-10 19:03:21 -04:00
emptyOutDir: false,
base: './',
2024-08-10 00:25:25 -04:00
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
2024-09-09 23:43:55 +08:00
target: "es2022",
outDir: '../../../../WGDashboard-Desktop',
2024-08-10 00:25:25 -04:00
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
}
}
2024-01-08 12:23:57 -05:00
}
2024-08-10 00:25:25 -04:00
}
2024-08-10 19:03:21 -04:00
return {
base: "/static/app/dist",
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server:{
proxy: {
'/api': proxy
2024-08-10 00:25:25 -04:00
},
2024-08-10 19:03:21 -04:00
host: '0.0.0.0'
},
build: {
2024-09-09 23:43:55 +08:00
target: "es2022",
2024-08-10 19:03:21 -04:00
outDir: 'dist',
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
2024-08-10 00:25:25 -04:00
}
}
}
2024-01-08 12:23:57 -05:00
}
})