Files
quyun/frontend/wechat/vite.config.js
2025-12-20 12:56:06 +08:00

65 lines
1.7 KiB
JavaScript

import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import compression from 'vite-plugin-compression';
export default defineConfig(() => {
const backendUrl = process.env.VITE_BACKEND_URL || 'http://127.0.0.1:8088';
return {
plugins: [
vue(),
compression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz',
}),
visualizer({
open: false,
gzipSize: true,
brotliSize: true,
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
host: '0.0.0.0',
allowedHosts: ['mp.jdwan.com'],
port: 3001,
open: true,
proxy: {
'/v1': {
target: backendUrl,
changeOrigin: true,
secure: false,
},
}
},
build: {
sourceMap: true,
minify: 'terser',
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'pinia'],
'player-vendor': ['xgplayer', 'xgplayer-mp4'],
}
}
},
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
}
}
}
};
});