import {defineConfig} from "vite"
import vue from "@vitejs/plugin-vue"
import {resolve} from "path"

export default defineConfig({
  plugins: [vue()],
    base: process.env.NODE_ENV === "production" ? "/" : "/",
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  build: {
    outDir: "dist",
    assetsDir: "assets",
    sourcemap: false,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["vue"],
          icons: ["lucide-vue-next"],
        },
      },
    },
  },
  server: {
    port: 3000,
    open: true,
      proxy: {
          '/api': {
              target: 'http://localhost:8080',
              changeOrigin: true,
              secure: false,
              //rewrite: path => path.replace(/^\/api/, '')
          }
      }
  },
})
