-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
55 lines (53 loc) · 1.38 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
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import VueJsx from '@vitejs/plugin-vue-jsx'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
// import EslintPlugin from 'vite-plugin-eslint'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
export default defineConfig(({ mode }) => {
// 加载环境变量
const env = loadEnv(mode, process.cwd())
return {
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => {
return tag.startsWith('micro-')
}
}
}
}),
VueJsx(),
createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/assets/svgs')],
symbolId: 'icon-[dir]-[name]'
}),
VueI18nPlugin({
runtimeOnly: true,
compositionOnly: true,
include: [path.resolve(__dirname, 'src/locales/**')]
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@_public': path.resolve(__dirname, 'public')
}
},
server: {
open: false,
port: 9527,
host: true,
proxy: {
'/api': {
target: env.VITE_API_PROXY,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
assetsInclude: ['**/*.glb', '**/*.gltf']
}
})