import { defineConfig } from 'vite';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
import fg from 'fast-glob';
import { createHtmlPlugin } from 'vite-plugin-html';

const __dirname = dirname(fileURLToPath(import.meta.url));

export default defineConfig({
  server: {
    open: true,
    port: 3000,
  },
  root: './test', // Root directory for the test files
  base: './', // Ensure relative paths for assets in production
  resolve: {
    extensions: ['.ts', '.js'],
  },
});

console.log('Resolved src directory:', resolve(__dirname, './dist'));
console.log('Resolved index.ts path:', resolve(__dirname, './dist/assets/iuav-ui.js'));
console.log('FS Allow Paths:', [
  resolve(__dirname, 'src'),
  __dirname,
]);