import {
	defineConfig
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';

export default defineConfig({
	plugins: [
		uni()
	],
	server: {
		host: '127.0.0.1',
		port: 8080,
		proxy: {
			'/api': {
				target: 'http://cht320621.gnway.cc:22075',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, ''), // 此处进行路径重写
			}
		}
	},
	build: {
		minify: 'terser',
		terserOptions: {
			compress: {
				drop_console: true, // 移除console
				drop_debugger: true // 移除debugger
			}
		},
		rollupOptions: {
			output: {
				manualChunks: {
					// 将第三方库单独打包
					vendor: ['vue', 'vuex', 'vue-i18n']
				}
			}
		}
	}
});