import path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";


// https://vitejs.dev/config/

export default defineConfig({
  plugins: [
    react(),
  ],
  build: {
    outDir: 'build',
    reportCompressedSize: true,
    sourcemap: false,
    rollupOptions: {
      output: {
        manualChunks(id) {
          // 根据需要进行手动代码分割
          if (id.includes('node_modules')) {
            return id.split('node_modules/')[1].split('/')[0]; // 将 node_modules 中的库分割成单独的块
          }
        },
      },
    },
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
});
