forked from noahss/clash-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 50
/
vite.config.ts
49 lines (48 loc) · 1.57 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
import react from '@vitejs/plugin-react'
import jotaiDebugLabel from 'jotai/babel/plugin-debug-label'
import jotaiReactRefresh from 'jotai/babel/plugin-react-refresh'
import UnoCSS from 'unocss/vite'
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import tsConfigPath from 'vite-tsconfig-paths'
export default defineConfig(
env => ({
plugins: [
// only use react-fresh
env.mode === 'development' && react({
babel: { plugins: [jotaiDebugLabel, jotaiReactRefresh] },
}),
tsConfigPath(),
UnoCSS(),
VitePWA({
injectRegister: 'inline',
manifest: {
icons: [{
src: '//cdn.jsdelivr.net/gh/Dreamacro/clash-dashboard/src/assets/Icon.png',
sizes: '512x512',
type: 'image/png',
}],
start_url: '/',
short_name: 'Clash Dashboard',
name: 'Clash Dashboard',
},
}),
splitVendorChunkPlugin(),
],
server: {
port: 3000,
},
base: './',
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "sass:math"; @import "src/styles/variables.scss";',
},
},
},
build: { reportCompressedSize: false },
esbuild: {
jsxInject: "import React from 'react'",
},
}),
)