-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
58 lines (57 loc) · 1.92 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
import {defineConfig, splitVendorChunkPlugin} from "vite";
import react from "@vitejs/plugin-react";
import jotaiDebugLabel from "jotai/babel/plugin-debug-label";
import jotaiReactRefresh from "jotai/babel/plugin-react-refresh";
import tsConfigPath from "vite-tsconfig-paths";
import {VitePWA} from "vite-plugin-pwa";
import UnoCSS from 'unocss/vite'
import {presetWind} from "unocss";
// https://vitejs.dev/config/
export default defineConfig((env) => {
return {
plugins: [
env.mode === "development" && react({
babel: {plugins: [jotaiDebugLabel, jotaiReactRefresh]},
}),
tsConfigPath(),
UnoCSS({
presets: [presetWind()],
theme: {},
}),
splitVendorChunkPlugin(),
VitePWA({
registerType: "autoUpdate", // 自动更新
injectRegister: "inline", // 注入到html中
manifest: {
icons: [{
src:
"//cdn.jsdelivr.net/gh/gtoxlili/give-advice/frontend/src/assets/logo.png",
sizes: "128x128",
type: "image/png",
}],
start_url: "/",
short_name: "WoMen",
name: "WoMen",
theme_color: "#ffffff",
},
}),
],
server: env.mode === "development"
? {
host: "0.0.0.0",
port: 3000,
proxy: {
"/api": {
target: "http://localhost:16807",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
}
: {},
base: "./",
build: {
reportCompressedSize: false,
},
};
});