import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig({
  esbuild: {
    minifyIdentifiers: false,
  },
  css: {
    transformer: 'lightningcss',
  },
  build: {
    cssMinify: 'lightningcss',
    outDir: 'Resources/Public',
    emptyOutDir: false,
    rollupOptions: {
      preserveEntrySignatures: "strict",
      input: {
        'JavaScript/context-menu/reservation-config': resolve(__dirname, 'Build/Sources/JavaScript/context-menu/reservation-config.js'),
        'JavaScript/ConfirmDelete': resolve(__dirname, 'Build/Sources/JavaScript/ConfirmDelete.js'),
        'JavaScript/calendar': resolve(__dirname, 'Build/Sources/JavaScript/calendar.js'),
        'JavaScript/fullcalendar-6': resolve(__dirname, 'Build/Sources/JavaScript/fullcalendar-6.js'),
        'JavaScript/handlePurposes': resolve(__dirname, 'Build/Sources/JavaScript/handlePurposes.js'),
        'JavaScript/ig_reservations': resolve(__dirname, 'Build/Sources/JavaScript/ig_reservations.js'),
        'Css/config': resolve(__dirname, 'Build/Sources/Scss/config.scss'),
        'Css/ig_reservations': resolve(__dirname, 'Build/Sources/Scss/ig_reservations.scss'),
        'Css/fullcalendar': resolve(__dirname, 'Build/Sources/Scss/fullcalendar.scss'),
        'Css/timeslot': resolve(__dirname, 'Build/Sources/Scss/timeslot.scss'),
      },
      external: [
        '@dp/ig_datapool_fe.js'
      ],
      output: {
          entryFileNames: "[name].js",
          assetFileNames: "[name].css",
      },
    },
  }
});