generated from LASER-Yi/frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
60 lines (55 loc) · 1.18 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
/// <reference types="vite/client" />
/// <reference types="node" />
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
import checker from "vite-plugin-checker";
import { VitePWA } from "vite-plugin-pwa";
import { dependencies } from "./package.json";
const groupedDeps = ["react", "react-dom", "react-icons"];
function renderChunks(deps: Record<string, string>) {
const chunks: Record<string, string[]> = {};
for (const key in deps) {
if (!groupedDeps.includes(key)) {
chunks[key] = [key];
}
}
return chunks;
}
export default defineConfig({
plugins: [
react(),
VitePWA({
// TODO
// includeAssets: [],
// manifest: {}
}),
checker({
typescript: true,
eslint: {
lintCommand: "eslint --ext .ts,.tsx src",
},
}),
],
base: "./",
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
manifest: true,
sourcemap: false,
rollupOptions: {
output: {
manualChunks: {
vendor: groupedDeps,
...renderChunks(dependencies),
},
},
},
},
server: {
host: true,
},
});