import base44 from '@base44/vite-plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

export default defineConfig(({ mode }) => {
  const shireModuleBuild = mode === 'shire';
  return {
    base: shireModuleBuild ? '/agents/scanforge/' : '/',
    plugins: [
      ...(!shireModuleBuild ? [base44({
        legacySDKImports: process.env.BASE44_LEGACY_SDK_IMPORTS === 'true',
        hmrNotifier: true,
        navigationNotifier: true,
        analyticsTracker: true,
        visualEditAgent: true
      })] : []),
      react()
    ],
    build: {
      sourcemap: true,
      manifest: true
    }
  };
});
