This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
105 lines (104 loc) · 2.58 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
97
98
99
100
101
102
103
104
105
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
import vueMarcos from 'unplugin-vue-macros/vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import legacy from '@vitejs/plugin-legacy';
import pages from 'vite-plugin-pages';
import autoImport from 'unplugin-auto-import/vite';
import vueComponents from 'unplugin-vue-components/vite';
import iconsResolver from 'unplugin-icons/resolver';
import icons from 'unplugin-icons/vite';
import eslint from '@modyqyw/vite-plugin-eslint';
import stylelint from 'vite-plugin-stylelint';
import compression from 'vite-plugin-compression';
// import mkcert from 'vite-plugin-mkcert';
import inspect from 'vite-plugin-inspect';
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? '/glossary/' : '/',
build: {
commonjsOptions: {
include: [],
},
target: 'es6',
cssTarget: 'chrome61',
},
css: {
preprocessorOptions: {
scss: {
charset: false,
additionalData: `@use "@/styles/variables.scss" as *;`,
},
},
},
optimizeDeps: {
disabled: false,
exclude: ['vue-demi'],
},
plugins: [
vueMarcos({
plugins: {
vue: vue({
reactivityTransform: true,
}),
vueJsx: vueJsx(),
},
}),
legacy({
targets: ['defaults', 'edge >= 79', 'firefox >= 67', 'safari >= 12', 'chrome >= 63'],
}),
pages({
exclude: [
'**/components/*.js',
'**/components/*.jsx',
'**/components/*.ts',
'**/components/*.tsx',
'**/components/*.vue',
],
}),
autoImport({
dirs: ['src/composables', 'src/composables/**', 'src/stores', 'src/stores/**'],
imports: ['vue', 'vue/macros', 'vue-router', '@vueuse/core'],
}),
vueComponents({
dirs: ['src/components'],
resolvers: [
{
type: 'component',
resolve: (componentName) => {
if (componentName === 'VIcon') {
return { name: 'Icon', from: '@iconify/vue' };
}
},
},
iconsResolver(),
],
}),
icons({
compiler: 'vue3',
defaultClass: 'el-icon el-icon-',
}),
eslint({
fix: true,
lintOnStart: true,
}),
stylelint({
fix: true,
lintOnStart: true,
}),
compression(),
// mkcert({
// autoUpgrade: true,
// source: 'coding',
// }),
inspect(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('src', import.meta.url)),
},
},
test: {
environment: 'jsdom',
},
});