import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

export default defineConfig({
  base: "/tool/speakr/static/vite/index/",
  plugins: [vue()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
      vue: "vue/dist/vue.esm-bundler.js"
    }
  },
  build: {
    outDir: "../../static/vite/index",
    emptyOutDir: true,
    manifest: true,
    sourcemap: true,
    rollupOptions: {
      input: fileURLToPath(new URL("./src/main.js", import.meta.url)),
      output: {
        entryFileNames: "assets/index.js",
        chunkFileNames: "assets/[name].js",
        assetFileNames: "assets/[name][extname]"
      }
    }
  },
  server: {
    host: "https://localhost",
    port: 8083,
    strictPort: false
  }
});