-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvite.config.ts
72 lines (70 loc) · 1.69 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
import { fileURLToPath } from 'node:url'
import vueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import tailwindcss from '@tailwindcss/vite'
import vue from '@vitejs/plugin-vue'
import { globSync } from 'glob'
import { visualizer } from 'rollup-plugin-visualizer'
import vueMacros from 'unplugin-vue-macros/vite'
import { defineConfig } from 'vite'
import { comlink } from 'vite-plugin-comlink'
import vueDevTools from 'vite-plugin-vue-devtools'
const input = globSync('./src/tools/*/index.html', {
posix: true,
})
.map((path) => `./${path}`)
.reduce((acc, path) => {
const key = path.match(/src\/tools\/(.+)\/index\.html/)![1]
acc[key] = path
return acc
}, {})
// https://vitejs.dev/config/
export default defineConfig({
root: fileURLToPath(new URL('./src', import.meta.url)),
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
test: {
globals: true,
includeTaskLocation: true,
environment: 'jsdom',
coverage: {
provider: 'istanbul',
reportsDirectory: '../coverage',
},
},
server: {
port: process.env.VITEST ? 50179 : undefined,
},
build: {
outDir: '../dist',
emptyOutDir: true,
sourcemap: 'hidden',
rollupOptions: {
input,
output: {
manualChunks: {
three: ['three'],
},
},
},
},
plugins: [
vueMacros({
plugins: {
vue: vue(),
},
}),
process.env.VITEST ? undefined : vueDevTools(),
visualizer(),
comlink(),
vueI18nPlugin({
include: fileURLToPath(new URL('./src/tools/*/locale/*.json', import.meta.url)),
}),
tailwindcss(),
],
worker: {
plugins: () => [comlink()],
},
})