import { resolve } from 'path'
import Tov from './presets/tov'
import { defineConfig } from 'vite'

export default defineConfig({
	//解决部署在子目录时assetsPublicPath等静态资源目录不对的问题
	base: "./",
	server: {
		proxy: {//代理转发
			"/api": {
				target: "http://127.0.0.1:18082",//转发到的目标地址
				changeOrigin: true,
				// rewrite: (path) => path.replace(/^\/api/, ""),//转把时把URL中的/api/替换为空
			},
		},
	},
	resolve: {
		alias: {
			'~/': `${resolve(__dirname, 'src')}/`,
		},
	},
	define: {
		__VUE_OPTIONS_API__: false, // 明确不使用 options api
	},
	plugins: [Tov()],
})
