-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
65 lines (60 loc) · 1.4 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
import browserslist from 'browserslist';
import legacy from "@vitejs/plugin-legacy";
import lightningCss from "postcss-lightningcss";
import solidPlugin from "vite-plugin-solid";
import { browserslistToTargets } from "lightningcss";
import { defineConfig, splitVendorChunkPlugin } from "vite";
const browsers = "last 30 versions or > 0.01% or not dead or last 3 IE versions";
export default defineConfig({
build: {
sourcemap: Boolean(process.env["BUILD_SOURCEMAPS"]),
minify: "terser",
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes("solid-js")) {
return "solidjs";
} else if (id.includes("@solidjs/router")) {
return "solidjs-router";
} else if (id.includes("dayjs")) {
return "dayjs";
} else if (id.includes("chart.js")) {
if (id.includes("helpers")) {
return "chart-js-helper";
}
return "chart-js";
} else if (id.includes("@kurkle/color")) {
return "color";
} else if (id.includes("@sentry")) {
return "sentry";
}
return "vendor";
}
}
}
},
css: {
postcss: {
plugins: [
lightningCss({
lightningcssOptions: {
targets: browserslistToTargets(browserslist(browsers))
}
})
]
}
},
plugins: [
solidPlugin(),
splitVendorChunkPlugin(),
legacy({
targets: [
browsers
],
}),
],
publicDir: "src/public",
server: {
port: 3000,
}
});