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

// 用来匹配地址,解决跨域问题
export default defineConfig({
  plugins: [uni()],
  resolve: {
	alias: {
	  '@': path.resolve(__dirname, '.')
	},
  },
  server: {
    proxy: {
      '/api': {
        target: 'https://www.gymmanage.xyz',
        changeOrigin: true,
        secure: true,
        bypass: function(req, res, proxyOptions) {
          if (req.url.indexOf('.js') !== -1 || req.url.indexOf('.vue') !== -1 || 
              req.url.indexOf('.css') !== -1 || req.url.indexOf('.json') !== -1) {
            return req.url
          }
        }
      }
    }
  }
})