import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    hmr: {
      host: 'localhost',
    },
    watch: {
      usePolling: true,
    },
  },
  build: {
    outDir: 'assets/dist',
    rollupOptions: {
      input: 'assets/js/main.js',
      output: {
        entryFileNames: 'main.js',
        assetFileNames: 'main.css'
      }
    }
  },
  resolve: {
    alias: {
      '@api': fileURLToPath(new URL('api', import.meta.url)),
      // '@': fileURLToPath(new URL('./src', import.meta.url)),
      // '@stores': fileURLToPath(new URL('./src/stores', import.meta.url)),
      // '@components': fileURLToPath(new URL('./src/components', import.meta.url)),
      // '@views': fileURLToPath(new URL('./src/views', import.meta.url)),
      // // '@icons': fileURLToPath(new URL('./node_modules/vue-material-design-icons', import.meta.url)),
      // '@node_modules': fileURLToPath(new URL('./node_modules', import.meta.url))
    }
  }
})
