-
Notifications
You must be signed in to change notification settings - Fork 51
/
vite.config.ts
103 lines (102 loc) · 2.65 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
/// <reference types="vitest" />
import { URL, fileURLToPath } from 'node:url'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import VueRouter from 'unplugin-vue-router/vite'
import { defineConfig } from 'vite'
import checker from 'vite-plugin-checker'
import viteCompression from 'vite-plugin-compression'
import tsconfigPaths from 'vite-tsconfig-paths'
import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
import Inspector from 'unplugin-vue-inspector/vite'
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@tests': fileURLToPath(new URL('./tests', import.meta.url))
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setupVitest.js'],
exclude: [
'packages/template/*',
'node_modules/**/*.spec.js',
'node_modules/**/*.test.js',
'node_modules/**/test.js',
],
},
css: {
devSourcemap: true,
postcss: {
plugins: [
tailwindcss({
config: './tailwind.config.ts',
}),
autoprefixer(),
],
},
},
plugins: [
tsconfigPaths(),
checker({
vueTsc: true,
}),
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => /^x-/.test(tag),
},
},
}),
Inspector({
launchEditor: 'cursor',
}),
VueRouter(),
vueJsx(),
AutoImport({
imports: ['vue', 'vue-router', 'vitest', VueRouterAutoImports],
dts: true,
}),
Components({}),
viteCompression(),
],
server: {
proxy: {
'/api': 'http://localhost:9081',
'/attachments': 'http://localhost:9081',
'/logout': 'http://localhost:9081',
'/testability': 'http://localhost:9081',
},
},
base: '/',
build: {
outDir: '../backend/src/main/resources/static/',
chunkSizeWarningLimit: 1000,
sourcemap: true,
rollupOptions: {
input: {
main: fileURLToPath(new URL('index.html', import.meta.url)),
},
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router'],
'ui-vendor': ['quill', 'gsap', 'marked', 'turndown']
},
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'main.css') return 'assets/main.css';
return 'assets/[name]-[hash][extname]';
},
},
},
},
optimizeDeps: {
include: ['vue', 'vue-router', 'quill', 'gsap', 'marked', 'turndown'],
exclude: ['fsevents']
}
})