mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
46 lines
957 B
TypeScript
46 lines
957 B
TypeScript
import tailwindcss from "@tailwindcss/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { defineConfig } from "vite";
|
|
|
|
const embedGoContent = `package assets
|
|
|
|
import "embed"
|
|
|
|
//go:embed index.html vite.svg assets/*
|
|
var FS embed.FS
|
|
`;
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
{
|
|
name: "generate-embed-go",
|
|
closeBundle() {
|
|
const outDir = path.resolve(__dirname, "../cmd/proxypilotui/assets");
|
|
fs.writeFileSync(path.join(outDir, "embed.go"), embedGoContent);
|
|
console.log("Generated embed.go");
|
|
},
|
|
},
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
build: {
|
|
outDir: "../cmd/proxypilotui/assets",
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: "assets/[name].js",
|
|
chunkFileNames: "assets/[name].js",
|
|
assetFileNames: "assets/[name].[ext]",
|
|
},
|
|
},
|
|
},
|
|
});
|