import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import graphql from '@rollup/plugin-graphql';
import { viteRequire } from 'vite-require'
import svgLoader from 'vite-svg-loader'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), graphql(), viteRequire(), svgLoader({defaultImport: 'raw'})],
  resolve: {
    alias: {
      '@': 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)),
      '@api': fileURLToPath(new URL('./src/api', import.meta.url))
      // '@icons': fileURLToPath(new URL('./node_modules/vue-material-design-icons', import.meta.url)),
    }
  },
  css: {
    preprocessorOptions: {
      scss: { 
         // example : additionalData: `@import "./src/design/styles/variables";`
         // dont need include file extend .scss
         additionalData: `@import "./src/assets/colors.scss";@import "./src/assets/common.scss";` 
     },
    },
  },
})
