import { defineConfig } from 'vite';
import string from 'vite-plugin-string';
import postcss from './postcss.config.js';
import fg from 'fast-glob';

// Vite configuration
export default defineConfig({
  server: {
    open: true, // Automatically open the browser
    port: 3000, // Default development port
  },
  plugins: [string()],
  css: {
    postcss,
  },
  build: {
    target: 'esnext', // Modern JavaScript for Lit
    rollupOptions: {
      output: {
        // Optional: Better chunk names for debugging
        entryFileNames: 'assets/[name].js',
        chunkFileNames: 'assets/[name].js',
        assetFileNames: 'assets/[name].[ext]',
      },
    },
  },
  resolve: {
    extensions: ['.ts', '.js'], // Resolve TypeScript and JavaScript files
  },
});