forked from MatinDehghanian/Ourenus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
34 lines (32 loc) · 981 Bytes
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { viteSingleFile } from "vite-plugin-singlefile";
import { generateIndexPHP } from "./generate-php";
import { fileURLToPath } from "url";
import path from "path";
// Define __dirname in ESM
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig(() => {
return {
plugins: [
react(),
viteSingleFile(),
{
name: "generate-index-php",
apply: "build",
closeBundle() {
const buildDir = path.resolve(__dirname, "build"); // Match the `outDir` setting
generateIndexPHP(buildDir);
},
},
],
build: {
outDir: "build", // Ensure the output matches your desired directory
sourcemap: false,
target: "esnext",
assetsInlineLimit: 100000000, // Inline large assets for single file build
cssCodeSplit: false,
},
};
});