import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import VueDevTools from 'vite-plugin-vue-devtools'
import Components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'

export default defineConfig({
    server: {
        port: 3008,
    },
    base: './',
    plugins: [vue(), vueJsx(), VueDevTools(), Components({
        resolvers: [AntDesignVueResolver({importStyle: false})],
    })],
    optimizeDeps: {
        exclude: ['@neptune/wasm', '@neptune/native'],
    },
    build: {
        rollupOptions: {
          external: ['@neptune/wasm', '@neptune/native'],
        },
      },
    css: {
        preprocessorOptions: {
            scss: {
                silenceDeprecations: ['import'],
                additionalData: `
                    @import "@/assets/scss/__variables.scss";
                    @import "@/assets/scss/__mixin.scss";
                `,
            },
        },
    },
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url)),
        },
    },
})
