forked from leon-kfd/Dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
64 lines (62 loc) · 1.59 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
import { defineConfig } from 'vite'
import { resolve } from 'path'
import Vue from '@vitejs/plugin-vue'
import VueJSX from '@vitejs/plugin-vue-jsx'
import VueMarkdown from 'vite-plugin-md'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
// import { visualizer } from 'rollup-plugin-visualizer'
let base = '/'
if (process.env.VITE_APP_BUILD_MODE === 'crx') base = './'
if (process.env.VITE_APP_BUILD_MODE === 'cdn') base = 'https://cdn.kongfandong.cn/howdz/dist/'
// https://vitejs.dev/config/
export default defineConfig({
base,
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
}
},
optimizeDeps: {
include: [
'vue',
'vue-i18n',
'pinia',
'pinia-plugin-persistedstate',
'vue-grid-layout',
'element-plus',
'vuedraggable',
'@howdyjs/to-control',
'@howdyjs/mouse-menu',
'dayjs'
]
},
css: {
preprocessorOptions: {
scss: {
charset: false,
additionalData: '@use "@/assets/element-variables" as *;'
// additionalData: "@import '@/assets/variables.scss';"
}
}
},
plugins: [
Vue({ include: [/\.vue$/, /\.md$/] }),
VueJSX(),
VueMarkdown(),
VueI18n({ include: resolve(__dirname, 'src/lang/locales/**') })
// visualizer()
],
build: {
outDir: process.env.VITE_APP_BUILD_MODE === 'crx' ? 'crx' : 'dist'
},
server: {
proxy: {
'/api': {
target: 'http://kongfandong.cn',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/api/, '')
}
}
}
})