-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
45 lines (40 loc) · 1 KB
/
vite.config.js
File metadata and controls
45 lines (40 loc) · 1 KB
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
35
36
37
38
39
40
41
42
43
44
45
import { copyFileSync } from "node:fs";
import { resolve } from "node:path";
import { defineConfig } from "vite";
import dataGeneratorPlugin from "./build/vite-plugin-data-generator.js";
// Simple plugin to copy README.md to dist during build
function copyReadmePlugin() {
return {
name: "copy-readme",
closeBundle() {
const src = resolve("README.md");
const dest = resolve("dist/README.md");
copyFileSync(src, dest);
console.log("✓ Copied README.md to dist");
},
};
}
export default defineConfig({
plugins: [
// Generate data models from directory structure at build time
dataGeneratorPlugin({
dataDir: "src/data",
outputDir: "src/generated",
}),
// Copy README.md to dist for documentation view
copyReadmePlugin(),
],
// Ensure generated files are not excluded from the build
assetsInclude: ["**/*.json"],
// Optimize build output
build: {
target: "esnext",
minify: "esbuild",
sourcemap: true,
},
// Configure dev server
server: {
port: 3000,
open: true,
},
});