import path from "path"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react(), tailwindcss()],
  define: {
    'process.env.NODE_ENV': '"production"',
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  build: {
    outDir: 'dist',
    emptyOutDir: false,  // Don't clear dist since we're building multiple times
    lib: {
      entry: path.resolve(__dirname, 'src/json_schema_node_entry.ts'),
      formats: ['es'],
      fileName: 'json_schema_node_entry',
    },
    rollupOptions: {
      output: {
        inlineDynamicImports: true,
      },
    },
    minify: true,
    sourcemap: true,
    cssCodeSplit: false,
  },
})
