-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
56 lines (54 loc) · 1.45 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
import { defineConfig } from 'vite'
import path, { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import UnoCSS from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import { ArcoResolver, NaiveUiResolver } from 'unplugin-vue-components/resolvers'
// import { createStyleImportPlugin } from 'vite-plugin-style-import'
export default ({ mode }) => {
const __DEV__ = mode === 'development'
return defineConfig({
base: __DEV__ ? '/' : './',
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`
}
},
plugins: [
vue(),
// tsx 手动导入的方式按需加载组件
// createStyleImportPlugin({
// libs: [
// {
// libraryName: '@arco-design/web-vue',
// esModule: true,
// resolveStyle: (name) => `@arco-design/web-vue/es/${name}/style/css.js`,
// },
// ],
// }),
Components({
resolvers: [
ArcoResolver({
sideEffect: true
}),
NaiveUiResolver()
]
}),
VueI18nPlugin({
include: resolve(__dirname, 'src/locales/**')
}),
UnoCSS()
// yaml(),
],
server: {
open: true
},
build: {
cssCodeSplit: true,
emptyOutDir: true,
chunkSizeWarningLimit: 1024,
sourcemap: false
}
})
}