import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import {resolve} from 'path'
import pkg from './package.json'

function renderChunks(deps: Record<string, string>) {
  let chunks = {};
  Object.keys(deps).forEach((key) => {
    if (['react', 'react-router-dom', 'react-dom'].includes(key)) return;
    chunks[key] = [key];
  });
  return chunks;
}
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  server:{
    port:8008,
    proxy:{
      "/proxyFile":{
        target:'https://33.cn/api/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/proxyFile/, '')
      }
    }
  },
  build:{
    sourcemap:false,
    rollupOptions:{

    }
  }
})
