// const LineChart = Loadable(lazy(() => import('../views/charts/LineChart')));
// const GredientChart = Loadable(lazy(() => import('../views/charts/GredientChart')));
// const DoughnutChart = Loadable(lazy(() => import('../views/charts/DoughnutChart')));
// const AreaChart = Loadable(lazy(() => import('../views/charts/AreaChart')));
// const ColumnChart = Loadable(lazy(() => import('../views/charts/ColumnChart')));
// const CandlestickChart = Loadable(lazy(() => import('../views/charts/CandlestickChart')));
// const RadialbarChart = Loadable(lazy(() => import('../views/charts/RadialbarChart')));

i want to reduce bundle size. i have commented out the paths and components i dont use in my router file. i am using react, and vite. i dont want to delete the files that came with the template, but i dont want to include them in the build bundle. 
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import fs from 'fs/promises';
import svgr from '@svgr/rollup';

// Define your base URL and sub URL here
const BASE_URL = 'https://ams.autobeatx.co.uk:8081';
const SUB_API_NAME = '/AMS';

// Active paths to include in the build
const includePaths = [
  // Layouts
  '../layouts/full/FullLayout',
  '../layouts/blank/BlankLayout',
  '../layouts/full/shared/loadable/Loadable',

  // Core features
  '../views/dashboard/Modern',
  '../views/pages/hr-module/calendar/HolidayCalendar',
  '../views/apps/user-profile/UserProfile',
  './ModuleFeatures',
  './ProtectedRoute',
  './Unauthorized',

  // Admin module
  '../views/pages/admin-module/AdminModule',
  '../views/pages/admin-module/firmManagement/FirmManagement',
  '../views/pages/admin-module/firmManagement/FirmDetails',
  '../views/pages/admin-module/firmManagement/FirmSchedulePicker',
  '../views/pages/admin-module/firmManagement/FeatureAssignmenttable',
  '../views/pages/admin-module/firmManagement/AttendanceMachineSelect',

  // HR module
  '../views/pages/hr-module/HRModule',
  '../views/pages/hr-module/userManagement/EnrollEmployee',
  '../views/pages/hr-module/userManagement/EmployeeManagementTabs',
  '../views/pages/hr-module/deptManagement/*',
  '../views/pages/hr-module/designationManagement/*',
  '../views/pages/hr-module/holidayManagement/*',
  '../views/pages/hr-module/userRightsManagement/*',

  // Attendance module
  '../views/pages/attendance-module/AttendanceModule',
  '../views/pages/attendance-module/manualAttendance/*',

  // Authentication
  '../views/authentication/auth1/*',
  '../views/authentication/auth2/*',
  '../views/authentication/Error',
  '../views/authentication/Maintenance',

  // Additional active modules
  '../views/pages/super-admin-module/TabbedDashboard',
  '../views/pages/report-module/*',
  '../views/pages/leave-module/*',
  '../views/pages/rota-module/*',
  '../views/pages/organization-module/OrganizationModule',
];

export default defineConfig({
  base: SUB_API_NAME,
  resolve: {
    alias: {
      src: resolve(__dirname, 'src'),
    },
  },
  esbuild: {
    loader: 'jsx',
    include: /src\/.*\.jsx?$/,
    exclude: [
      // Exclude unused UI components
      '**/ui-components/**',
      '**/widgets/**',
      '**/forms/**',
      '**/tables/**',
      '**/charts/**',
      '**/apps/blog/**',
      '**/apps/eCommerce/**',
      '**/apps/chat/**',
      '**/apps/notes/**',
      '**/apps/email/**',
      '**/apps/tickets/**',
      '**/apps/contacts/**',
    ],
  },
  optimizeDeps: {
    include: includePaths,
    esbuildOptions: {
      loader: {
        '.js': 'jsx',
      },
      plugins: [
        {
          name: 'load-js-files-as-jsx',
          setup(build) {
            build.onLoad({ filter: /src\\.*\.js$/ }, async (args) => {
              // Only process files that are in includePaths
              if (includePaths.some((path) => args.path.includes(path))) {
                return {
                  loader: 'jsx',
                  contents: await fs.readFile(args.path, 'utf8'),
                };
              }
              return null;
            });
          },
        },
      ],
    },
  },
  plugins: [svgr(), react()],
  define: {
    'import.meta.env.VITE_API_DOMAIN': JSON.stringify(BASE_URL),
    'import.meta.env.VITE_SUB_API_NAME': JSON.stringify(SUB_API_NAME),
  },
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, 'index.html'),
      },
      output: {
        manualChunks(id) {
          // Create separate chunks for major features
          if (id.includes('hr-module')) return 'hr';
          if (id.includes('admin-module')) return 'admin';
          if (id.includes('attendance-module')) return 'attendance';
          if (id.includes('authentication')) return 'auth';
          if (id.includes('report-module')) return 'reports';
          if (id.includes('leave-module')) return 'leave';
          if (id.includes('rota-module')) return 'rota';
        },
      },
    },
  },
  server: {
    host: true,
    port: 5174,
  },
});