-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.mjs
More file actions
56 lines (51 loc) · 1.33 KB
/
vite.config.mjs
File metadata and controls
56 lines (51 loc) · 1.33 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
46
47
48
49
50
51
52
53
54
55
56
import react from "@vitejs/plugin-react";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "path";
import { cwd } from "process";
import { defineConfig, loadEnv } from "vite";
import { robotsTxtGenerator } from "./src/plugins/robotsTxtGenerator.ts";
import { sitemapGenerator } from "./src/plugins/sitemapGenerator.ts";
const __dirname = dirname(fileURLToPath(import.meta.url));
const baseUrl = "https://news.icpc.global";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, cwd(), "");
return {
plugins: [
react(),
sitemapGenerator({
baseUrl,
publicUrl: env.PUBLIC_URL,
}),
robotsTxtGenerator({
baseUrl,
publicUrl: env.PUBLIC_URL,
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
"@data": resolve(__dirname, env.VITE_DATA_FOLDER || "data"),
},
},
server: {
port: 3000,
},
build: {
target: "esnext",
emptyOutDir: true,
outDir: env.PUBLIC_URL || "dist",
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes("@tanstack")) {
return "tanstack";
}
if (id.includes("react")) {
return "react";
}
},
},
},
},
};
});