-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
69 lines (67 loc) · 2.54 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
import {fileURLToPath, URL} from 'url'
import {defineConfig, loadEnv} from 'vite'
import {resolve, dirname} from 'node:path'
import {quasar, transformAssetUrls} from '@quasar/vite-plugin'
import vue from '@vitejs/plugin-vue'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import {visualizer} from 'rollup-plugin-visualizer'
// https://vitejs.dev/config/
export default defineConfig(({command, mode}) => {
if (command) {
const env = loadEnv(mode, process.cwd(), '')
return {
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
zxcvbn: [
'zxcvbn'
]
}
}
}
},
define: {
__APP_ENV__: JSON.stringify(env.APP_ENV),
},
plugins: [
vue({
template: {transformAssetUrls}
}),
quasar({
autoImportComponentCase: 'pascal'
}),
// See https://vue-i18n.intlify.dev/guide/advanced/optimization.html
VueI18nPlugin({
include: resolve(dirname(fileURLToPath(import.meta.url)), './src/locales/**'),
}),
visualizer()
],
publicDir: env.PUBLIC_FOLDER,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'#': fileURLToPath(new URL('./types', import.meta.url)),
'~': fileURLToPath(new URL('./tests', import.meta.url)),
// These lines are used to disable script unsafe-eval in Nginx CSP config.
'vue': fileURLToPath(new URL('./node_modules/vue/dist/vue.runtime.esm-bundler.js', import.meta.url)),
'vue-i18n': fileURLToPath(new URL('./node_modules/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js', import.meta.url)),
},
},
server: {
port: 3000,
},
test: {
environment: 'jsdom',
coverage: {
extension: ['.ts'],
include: ['src/composables', 'src/plugins', 'src/stores'],
exclude: ['src/composables/useAxios.ts', 'src/composables/useColorVariants.ts'],
}
}
}
} else {
return {}
}
})