-
Notifications
You must be signed in to change notification settings - Fork 37
/
vite.config.ts
100 lines (100 loc) · 2.58 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import svgr from "@svgr/rollup";
import react from "@vitejs/plugin-react";
import path, { resolve } from "path";
import { defineConfig } from "vite";
import mkcert from "vite-plugin-mkcert";
import { VitePWA } from "vite-plugin-pwa";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
mkcert(),
svgr({ dimensions: false, svgo: false, typescript: true }),
react(),
wasm(),
topLevelAwait(),
VitePWA({
registerType: "autoUpdate",
devOptions: {
enabled: process.env.VITE_PUBLIC_DEV === "true",
},
workbox: {
maximumFileSizeToCacheInBytes: 4000000,
},
manifest: {
name: "Eternum",
short_name: "Eternum",
description: "Rule the Hex",
theme_color: "#000000",
background_color: "#000000",
display: "standalone",
orientation: "landscape",
scope: "/",
start_url: "/",
icons: [
{
src: "/images/pwa-64x64.png",
sizes: "64x64",
type: "image/png",
purpose: "any maskable",
},
{
src: "/images/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any maskable",
},
{
src: "/images/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable",
},
],
},
}),
],
resolve: {
alias: {
events: "events",
"@": path.resolve(__dirname, "./src"),
},
},
build: {
target: "esnext",
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
map: resolve(__dirname, "map/index.html"),
hex: resolve(__dirname, "hex/index.html"),
},
maxParallelFileOps: 2,
cache: false,
// external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
sourcemap: true,
manualChunks: (id) => {
if (id.includes("node_modules")) {
return "vendor";
}
},
inlineDynamicImports: false,
sourcemapIgnoreList: (relativeSourcePath) => {
const normalizedPath = path.normalize(relativeSourcePath);
return normalizedPath.includes("node_modules");
},
},
},
},
optimizeDeps: {
exclude: [
"js-big-decimal",
"@bibliothecadao/eternum", // Add your dependency here
],
},
});