import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import md5 from "md5-hash";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni()],
  build: {
    rollupOptions: {
      output: {
        assetFileNames(d) {
          const baseName = d.name.replace(/\\/g, "/").split("/").pop();
          const newName = md5(baseName) + ".[hash].[extname]";
          return `assets/${newName}`;
        },
      },
    },
  },
});
