import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import basicSsl from '@vitejs/plugin-basic-ssl'; // 推荐使用这个插件简化自签名证书管理

import path from 'path'
// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(),basicSsl()],
  server: {
    https: true, // 启用 HTTPS
    host: 'localhost', // 确保 host 是 localhost
    port: 5173,
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  build: {
    // sourcemap: true,
    chunkSizeWarningLimit: 1000,
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes('src/components')) {
              return 'components';
          }

          if (id.includes('src/views/dashboard')) {
            return 'views-dashboard'
          }

          if (id.includes('src/stores')) {
            return 'stores';
          }
        }
      }
    }
  },
});
