import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' // https://vitejs.dev/config/ export default defineConfig({ base: './', resolve: { alias: { /* 路径别名 若为文件系统路径必须是绝对路径的形式,否则将以别名原样呈现,不会解析为文件系统路径路径 */ '@': path.resolve(__dirname, './src') } }, plugins: [vue()], server: { host: 'localhost', port: 6547, open: true, strictPort: false, https: false // 反向代理 // proxy: { // '/': { // target: 'http://172.16.1.215:5000', // changeOrigin: true, // rewrite: (path) => path.replace(/^\//, '') // }, // } }, build: { rollupOptions: { input: { admin: path.resolve(__dirname, 'admin.html'), index: path.resolve(__dirname, 'index.html'), login: path.resolve(__dirname, 'login.html') }, output: { // 静态资源分类打包 chunkFileNames: 'js/[name]-[hash].js', entryFileNames: 'js/[name]-[hash].js', assetFileNames: 'assets/[name]-[hash].[ext]' } }, terserOptions: { // 去掉打印 compress: { drop_console: true, drop_debugger: true } } }, })