-
Notifications
You must be signed in to change notification settings - Fork 99
/
vite.config.ts
42 lines (41 loc) · 1.08 KB
/
vite.config.ts
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
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import chokidar from "chokidar";
import { resolve } from "node:path";
import { processSVGs } from "./tools/lib/process-svgs.js";
export default defineConfig({
base: "/facesjs",
build: {
chunkSizeWarningLimit: 1000,
emptyOutDir: true,
outDir: "../build-site",
rollupOptions: {
input: {
main: resolve(import.meta.dirname, "public/index.html"),
editor: resolve(import.meta.dirname, "public/editor/index.html"),
},
},
},
plugins: [
react(),
{
name: "process-svgs",
async config() {
// Always run this, for both build and dev
await processSVGs();
},
async configureServer() {
// Only during dev
chokidar
.watch([resolve(import.meta.dirname, "svgs")], {
ignoreInitial: true,
})
.on("all", (event, filePath) => {
console.log(`Detected change in SVGs: ${event} ${filePath}`);
processSVGs();
});
},
},
],
root: "public",
});