完成水电表列表

This commit is contained in:
Zy
2026-04-18 18:14:07 +08:00
parent 9a95e2b7e3
commit d0888c6afb
115 changed files with 2842 additions and 343 deletions

View File

@@ -5,6 +5,7 @@ import path from 'path';
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd());
const isBuild = command === 'build';
return {
// 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
@@ -25,7 +26,7 @@ export default defineConfig(({ mode, command }) => {
open: true,
proxy: {
[env.VITE_APP_BASE_API]: {
target: 'http://192.168.1.222:8080',
target: env.VITE_APP_PROXY_API || 'http://192.168.1.222:8080',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
@@ -34,7 +35,34 @@ export default defineConfig(({ mode, command }) => {
},
build: {
outDir: 'dist',
cleanOutDir: true
cleanOutDir: true,
sourcemap: !isBuild, // ✅ 优化6开发环境开启 sourcemap 方便调试
// ✅ 1. 显式指定使用 terser 压缩
minify: 'terser',
terserOptions: {
compress: {
drop_console: isBuild,
drop_debugger: isBuild
},
format: {
// 移除所有注释
comments: false
}
},
rollupOptions: {
output: {
// ✅ 优化8拆包策略核心优化
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: 'static/js/[name]-[hash].js',
assetFileNames: 'static/assets/[name]-[hash].[ext]',
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'pinia'], // Vue 生态单独拆包
'element-plus': ['element-plus', '@element-plus/icons-vue'], // Element Plus 单独拆包
'echarts': ['echarts'], // ECharts 单独拆包
'utils': ['axios', '@vueuse/core', 'vue-i18n'] // 工具库单独拆包
}
}
}
},
css: {
preprocessorOptions: {