-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
49 lines (49 loc) · 1.19 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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// @ts-ignore
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { TDesignResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
// @ts-ignore
// @ts-ignore
export default defineConfig({
plugins: [
vue(),
AutoImport({
resolvers: [
TDesignResolver({library: 'vue-next'}),
],
}),
Components({
resolvers: [
TDesignResolver({library: 'vue-next'}),
],
}),
],
resolve: {
// 配置路径别名
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
cors: true, // 默认启用并允许任何源
open: true, // 在服务器启动时自动在浏览器中打开应用程序
//反向代理配置,注意rewrite写法,开始没看文档在这里踩了坑
port: 12221,
host: '0.0.0.0',
},
css: {
modules: {
generateScopedName: '[name]__[local]__[hash:base64:5]',
hashPrefix: 'prefix',
},
preprocessorOptions: {
less: {
javascriptEnabled: true,
}
}
}
})