-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
96 lines (92 loc) · 2.6 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
import path from 'node:path'
import fs from 'node:fs'
import { fileURLToPath } from 'node:url'
import { build, defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import eslint from 'vite-plugin-eslint'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import progress from 'vite-plugin-progress'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
server: {
host: '0.0.0.0',
port: 8080,
strictPort: true
},
resolve: {
alias: {
'@': path.resolve(path.dirname(fileURLToPath(import.meta.url)), './src')
}
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
plugins: [
vue(),
eslint({
cache: true
}),
AutoImport({
imports: ['vue', 'vue-router'],
dts: 'src/types/auto-imports.d.ts'
}),
Components({
dts: 'src/types/components.d.ts',
globs: ['src/components/**/*.vue', 'src/plugins/**/components/*.vue'],
deep: true,
resolvers: [
AntDesignVueResolver({ importStyle: 'less', resolveIcons: true }),
IconsResolver(),
(componentName) => {
switch (componentName) {
case 'ColorPicker':
return { name: 'ColorPicker', from: 'vue3-colorpicker' }
}
}
],
allowOverrides: true
}),
Icons({
compiler: 'vue3'
}),
progress()
],
define: {
__APP_VERSION__: `"${process.env.npm_package_version}"`,
__DEV_URL__: `"10.0.0.230:39075"`,
__PROD_URL__: `"livekun-webapi.anankun.icu:4433"`
},
build: {
rollupOptions: {
onwarn(warning, defaultHandler) {
if (warning.code === 'INVALID_ANNOTATION') {
return
}
defaultHandler(warning)
},
output: {
sanitizeFileName(name) {
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g
const DRIVE_LETTER_REGEX = /^[a-z]:/i
const match = DRIVE_LETTER_REGEX.exec(name)
const driveLetter = match ? match[0] : ''
return (
driveLetter +
name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '')
)
}
}
}
}
}
})