import {
	defineConfig
} from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'
const define = {
	__VUE_PROD_DEVTOOLS__: 'false'
}
if (!["mp-weixin", "h5", "web"].includes(process.env.UNI_PLATFORM)) {
	define['global'] = '{}'
	define['wx'] = 'uni'
}
export default defineConfig({
	resolve: {
		alias: {
			'@': path.resolve(__dirname, '.')
		}
	},
	plugins: [uni()],
	define,
	// base: process.env.NODE_ENV === 'production' ? './' : '/',
	// transpileDependencies: ['@dcloudio/uni-ui'],
	server: {
		port: 8088,
		proxy: {
			'/api': {
				// target: 'http://192.168.1.32:47001/api/',
				target: 'https://dev3.k12100.net/teaching/api/', // 目标后端服务器地址
				// target: 'https://www.k12100.com/teaching/api/',
				changeOrigin: true, // 是否改变源
				// rewrite: (path) => path.replace(/^\/api/, '/') // 重写路径
				rewrite: (path) => path.endsWith('.js') ? '' : path.replace(/^\/api/, '/')
			}
		}
	}
})