-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathvite.config.ts
101 lines (100 loc) · 2.51 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
97
98
99
100
101
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
import Unocss from 'unocss/vite'
import { presetUno, presetIcons, transformerDirectives } from 'unocss'
import presetAutoprefixer from 'unocss-preset-autoprefixer'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ArcoResolver } from 'unplugin-vue-components/resolvers'
import { visualizer } from 'rollup-plugin-visualizer'
import topLevelAwait from 'vite-plugin-top-level-await'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
export default defineConfig(async () => ({
plugins: [
vue(),
VueI18nPlugin({
include: ['./src/locales/**']
}),
Unocss({
presets: [presetUno(), presetIcons(), presetAutoprefixer()],
transformers: [
transformerDirectives({
applyVariable: ['--uno']
})
]
}),
AutoImport({
dts: './src/types/auto-import.d.ts',
eslintrc: {
enabled: true
},
imports: [
'vue',
'pinia',
'vue-i18n',
{
'@arco-design/web-vue': ['Message']
}
],
resolvers: [ArcoResolver()],
vueTemplate: true,
dirs: [
'./src/api/*',
'./src/constants/*',
'./src/hooks/*',
'./src/sqls/*',
'./src/stores/*',
'./src/utils/*'
]
}),
Components({
dts: './src/types/components.d.ts',
resolvers: [
ArcoResolver({
resolveIcons: true
})
]
}),
visualizer(),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`
})
],
resolve: {
alias: {
'@': '/src'
}
},
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: '0.0.0.0'
},
envPrefix: ['VITE_', 'TAURI_'],
build: {
target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
sourcemap: !!process.env.TAURI_DEBUG
},
css: {
postcss: {
plugins: [
autoprefixer({
overrideBrowserslist: [
'Android 4.1',
'iOS 7.1',
'Chrome > 31',
'ff > 31',
'ie >= 8',
'last 10 versions'
]
})
]
}
}
}))