aboutsummaryrefslogtreecommitdiffstats
path: root/vite.config.js
blob: 32732454dd886a2e78ed14f756ee26c46c733a79 (plain) (blame)
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
46
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";

import { defineConfig } from "vite";

export default defineConfig({
	plugins: [tailwindcss({ optimize: false }), sveltekit()],
	css: {
		transformer: "postcss",
	},
	preview: {
		allowedHosts: [
			"coinos.io",
			"6un2jrlcumn5vduhbq6i3i2wrwiydamwjwop472obg6cy2bfo6ua3oad.onion",
			"vm7h454g5hiy2nt3u5o7evtz3vigtypo2mkyausakvdkbmd7wpyhx5qd.onion",
		],
	},
	server: {
		proxy:
			process.env.NODE_ENV === "development"
				? {
						"/api/": {
							target: "http://localhost:3119",
							rewrite: (path) => path.replace(/^\/api\//, ""),
						},
				  }
				: undefined,
	},
	build: {
		cssMinify: "esbuild",
		chunkSizeWarningLimit: 1000,
		rollupOptions: {
			output: {
				manualChunks(id) {
					if (id.includes("node_modules")) {
						const parts = id.split("node_modules/")[1].split("/");
						const pkg = parts[0].startsWith("@")
							? `${parts[0]}/${parts[1]}`
							: parts[0];
						return `vendor-${pkg}`;
					}
				},
			},
		},
	},
});