// frontend/vite.config.js
import { defineConfig } from 'vite';
import path from 'path'; // Import path module

export default defineConfig({
  resolve: {
    alias: {
      // Force all @codemirror/state imports to resolve to a single instance
      '@codemirror/state': path.resolve(__dirname, 'node_modules/@codemirror/state'),
      '@codemirror/view': path.resolve(__dirname, 'node_modules/@codemirror/view'),
    },
  },
  build: {
    lib: {
      entry: 'src/main.js', // This will be our main entry point
      name: 'ProjectNotesFrontend',
      fileName: (format) => `project-notes-frontend.${format}.js`
    },
    outDir: '../static/dist', // Output to a new 'dist' folder inside the existing 'static' directory
    emptyOutDir: true,
    rollupOptions: {
      output: {
        // Ensure that the output is a single file
        manualChunks: undefined,
      }
    }
  }
});
