-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
72 lines (68 loc) · 1.59 KB
/
Copy pathvite.config.ts
File metadata and controls
72 lines (68 loc) · 1.59 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { defineConfig } from "vite";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import babel from "@rolldown/plugin-babel";
import { fileURLToPath } from "node:url";
import { compression } from "vite-plugin-compression2";
const excludeList = [
/\.skel$/i,
/\.(png|webp|jpe?g|avif)$/i,
/\.(mp3|ogg|wav|m4a)$/i,
/\.(mp4|webm)$/i,
/\.(woff2?|ttf|eot)$/i,
/\.(br|gz)$/i,
];
export default defineConfig({
resolve: {
alias: [
{
find: "@",
replacement: fileURLToPath(new URL("./src", import.meta.url)),
},
],
},
optimizeDeps: {
extensions: ["phaser.esm.js"],
rolldownOptions: {
output: {
minify: true,
},
},
},
plugins: [
react(),
babel({
presets: [reactCompilerPreset()],
}),
compression({
algorithms: ["gzip", "brotliCompress"],
threshold: 1024,
exclude: excludeList,
}),
],
assetsInclude: ["**/*.skel", "**/*.atlas"],
build: {
assetsInlineLimit: 0,
chunkSizeWarningLimit: 1400,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules/phaser")) {
return "phaser-vendor";
}
if (id.includes("@esotericsoftware") || id.includes("spine")) {
return "spine-vendor";
}
if (
id.includes("node_modules/react") ||
id.includes("node_modules/react-dom")
) {
return "react-vendor";
}
if (id.includes("node_modules")) {
return "vendor";
}
},
},
},
},
});