import {defineConfig} from 'vite'
import {createVuePlugin} from 'vite-plugin-vue2'
import {resolve} from 'path'
import WindiCss from 'vite-plugin-windicss';

// https://vitejs.dev/config/
export default defineConfig(({command}) => {
    const config = {
        plugins: [
            createVuePlugin({
                jsx: true,
            }),
            WindiCss()
        ],
        server: {
            port: 3001,
        },
        build: {
            target: 'esnext'
        },
        resolve: {
            alias: {
                '~': resolve(__dirname, 'src'),
                '@': resolve(__dirname, 'src'),
                '@c': resolve(__dirname, 'src/components'),
            },
        },
        css: {}
    }
    if (command === 'build') {
        config.base = ''
    } else {
        config.base = '/'
    }

    return config
})
