import { defineConfig } from 'vite' import uni from '@dcloudio/vite-plugin-uni' // 导出配置 export default defineConfig({ plugins: [ uni(), ], // 服务器配置(解决网络驱动器监视问题) server: { watch: { usePolling: true, // 启用轮询模式(关键配置) interval: 1000, // 轮询间隔(毫秒),可根据网络情况调整 followSymlinks: false, // 不跟踪符号链接 ignored: [ // 排除不必要的监视 'node_modules/**', '**/dist/**', '**/.git/**', '**/.DS_Store', '**/Thumbs.db' ] }, // 其他服务器优化(可选) host: '0.0.0.0', // 允许外部访问 port: 3000, // 端口号 hmr: { overlay: false // 关闭HMR覆盖层(可选) } }, // 构建配置(可选优化) build: { chunkSizeWarningLimit: 1500, // 增大代码块警告限制 minify: 'terser', // 使用terser压缩(比esbuild更彻底) terserOptions: { compress: { drop_console: process.env.NODE_ENV === 'production' // 生产环境移除console } } } })