-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.js
92 lines (81 loc) · 1.91 KB
/
vite.config.js
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
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import vue from '@vitejs/plugin-vue2'
import legacy from '@vitejs/plugin-legacy'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'node:path'
// / <reference types="vitest" />
// / <reference types="vite/client" />
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `
@import "@/assets/scss/custom.scss";
`
}
}
},
plugins: [
vue({
target: 'modern',
vueTemplateOptions: {
compilerOptions: {
whiteSpace: 'condense'
},
transformAssetUrls: {
video: ['src', 'poster'],
source: ['src'],
img: ['src'],
image: ['xlink:href', 'href'],
use: ['xlink:href', 'href'],
'b-avatar': 'src',
'b-img': 'src',
'b-img-lazy': 'src',
'b-card': 'img-src',
'b-card-img': 'src',
'b-card-img-lazy': ['src', 'blank-src'],
'b-carousel-slide': 'img-src',
'b-embed': 'src'
}
}
}),
legacy({
targets: [
'defaults and not IE 11'
]
}),
// Good chunking strategy for SPA
// See: https://vitejs.dev/guide/build.html#chunking-strategy
splitVendorChunkPlugin(),
createSvgIconsPlugin({
iconDirs: [
path.resolve(__dirname, 'src/assets/icons/editor'),
path.resolve(__dirname, 'src/assets/icons')
],
symbolId: '[name]'
})
],
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
},
extensions: ['.js', '.mjs', '.json', '.vue']
},
server: {
port: '8080'
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: 'tests/setup.js'
}
})