mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-07 02:53:38 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
import path from "path";
|
|
import fs from "fs";
|
|
import type { Plugin } from "vite";
|
|
|
|
function renameIndexHtml(): Plugin {
|
|
return {
|
|
name: "rename-index-html",
|
|
closeBundle() {
|
|
const outDir = path.resolve(__dirname, "../package/share/ahriman/templates");
|
|
const src = path.join(outDir, "index.html");
|
|
const dest = path.join(outDir, "build-status.jinja2");
|
|
if (fs.existsSync(src)) {
|
|
fs.renameSync(src, dest);
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tsconfigPaths(), renameIndexHtml()],
|
|
base: "/",
|
|
build: {
|
|
outDir: path.resolve(__dirname, "../package/share/ahriman/templates"),
|
|
emptyOutDir: false,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: "static/[name].js",
|
|
chunkFileNames: "static/[name].js",
|
|
assetFileNames: "static/[name].[ext]",
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": "http://localhost:8080",
|
|
},
|
|
},
|
|
});
|