import { defineConfig } from "vite"; import path from "path"; import uni from "@dcloudio/vite-plugin-uni"; import md5 from "md5-hash"; // https://vitejs.dev/config/ export default defineConfig({ resolve: { alias: { "@": path.join(__dirname, "./src"), }, }, css: { preprocessorOptions: { scss: { api: "modern-compiler", silenceDeprecations: ["legacy-js-api"], }, }, }, plugins: [uni()], build: { commonjsOptions: { transformMixedEsModules: true, }, rollupOptions: { output: { assetFileNames(d) { const baseName = d.name.replace(/\\/g, "/").split("/").pop(); const newName = md5(baseName) + ".[hash].[extname]"; return `assets/${newName}`; }, }, }, }, });