import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { alias } from "./vite.config";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias,
  },
  build: {
    minify: false, // Отключает минификацию
    sourcemap: true, // Включает sourcemaps для отладки
    copyPublicDir: false,
    rollupOptions: {
      input: "src/widget.tsx",
      preserveEntrySignatures: "allow-extension",
      output: {
        manualChunks: undefined,
        entryFileNames: "[name].js",
        chunkFileNames: "[name].js",
        assetFileNames: "[name].[ext]",
      },
    },
    outDir: "widget",
  },
  define: {
    "process.env": process.env,
  },
});
