generated from kingyue737/vitify-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
96 lines (95 loc) · 2.5 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
import path from 'path'
import { defineConfig } from 'vite'
import vue2 from '@vitejs/plugin-vue2'
import legacy from '@vitejs/plugin-legacy'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { createSvgPlugin } from '@kingyue/vite-plugin-vue2-svg'
import { splitVendorChunkPlugin } from 'vite'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import Inspect from 'vite-plugin-inspect'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import browserslistToEsbuild from 'browserslist-to-esbuild'
// https://vitejs.dev/config/
export default defineConfig({
build: { target: browserslistToEsbuild() },
server: {
port: 9527,
},
plugins: [
vue2(),
Pages(),
Layouts(),
legacy({
modernPolyfills: true,
renderLegacyChunks: false,
}),
Components({
resolvers: [
{
type: 'component',
resolve: (name) => {
const blackList = ['VChart', 'VHeadCard']
if (name.match(/^V[A-Z]/) && !blackList.includes(name))
return { name, from: 'vuetify/lib' }
},
},
],
dirs: [],
dts: false,
types: [],
}),
AutoImport({
imports: [
'vue',
'pinia',
'vue-router/composables',
{ 'vue-i18n-bridge': ['useI18n'] },
],
dts: 'src/auto-imports.d.ts',
dirs: ['src/stores'],
vueTemplate: false,
}),
createSvgPlugin(),
splitVendorChunkPlugin(),
VueI18n({
runtimeOnly: false,
compositionOnly: true,
fullInstall: false,
include: [path.resolve(__dirname, 'src/locales/**')],
}),
Inspect(),
],
css: {
devSourcemap: true,
// https://vitejs.dev/config/#css-preprocessoroptions
preprocessorOptions: {
sass: {
additionalData: [
// vuetify variable overrides
'@import "@/assets/styles/vuetify-variables.scss"',
'',
].join('\n'),
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'vue-echarts': 'vue-echarts/dist/index.esm.min.js',
'vue-i18n-bridge':
'vue-i18n-bridge/dist/vue-i18n-bridge.runtime.esm-bundler.js',
},
},
test: {
alias: { vue: 'vue/dist/vue.runtime.mjs' },
globals: true,
include: ['test/**/*.test.ts', 'src/**/__tests__/*'],
environment: 'jsdom',
deps: {
inline: ['vuetify', '@vueuse', 'echarts'],
},
setupFiles: ['./test/vitest.setup.ts'],
},
})