import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { join } from 'node:path';

console.log(__dirname);

export default defineConfig({
  plugins: [svelte()],

  resolve: {
    alias: {
      $lib: join(__dirname, 'src/lib'),
      $assets: join(__dirname, 'src/assets/'),
      $styles: join(__dirname, 'src/styles/app.postcss')
    }
  },

  publicDir: false,

  clearScreen: false,

  server: {
    strictPort: true,
    port: 3000
  },

  envPrefix: ['VITE_', 'TAURI_'],

  build: {
    target: ['es2021', 'chrome100', 'safari13'],
    minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
    sourcemap: !!process.env.TAURI_DEBUG
  }
});
