// Plugins import Components from "unplugin-vue-components/vite"; import Vue from "@vitejs/plugin-vue"; import Vuetify, { transformAssetUrls } from "vite-plugin-vuetify"; // Utilities import { defineConfig } from "vite"; import { fileURLToPath, URL } from "node:url"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ Vue({ template: { transformAssetUrls }, }), Vuetify(), Components(), ], optimizeDeps: { exclude: ["vuetify"], include: ["axios", "vue-router", "vue-loading-overlay"], }, define: { "process.env": {} }, resolve: { alias: { "@": fileURLToPath(new URL("src", import.meta.url)), }, extensions: [".js", ".json", ".jsx", ".mjs", ".ts", ".tsx", ".vue"], }, server: { port: 3000, proxy: { "/api": "http://localhost:8080", }, }, css: { preprocessorOptions: { sass: { api: "modern-compiler", }, scss: { api: "modern-compiler", }, }, }, build: { target: "esnext", minify: "terser", terserOptions: { compress: { drop_console: true, }, }, rollupOptions: { output: { manualChunks: { "vuetify": ["vuetify"], "vendor": ["axios", "dayjs", "vue-router", "vue-loading-overlay"], }, chunkFileNames: "js/[name].[hash].js", entryFileNames: "js/[name].[hash].js", assetFileNames: (assetInfo) => { const info = assetInfo.name.split("."); const ext = info[info.length - 1]; if (/png|jpe?g|gif|tiff|bmp|ico/i.test(ext)) { return `images/[name].[hash][extname]`; } else if (/woff|woff2|eot|ttf|otf/i.test(ext)) { return `fonts/[name].[hash][extname]`; } else if (ext === "css") { return `css/[name].[hash][extname]`; } return `[name].[hash][extname]`; }, }, }, chunkSizeWarningLimit: 1000, reportCompressedSize: true, }, });