-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
66 lines (53 loc) · 1.42 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
import { resolve } from 'path';
import Vue from '@vitejs/plugin-vue';
import jsx from '@vitejs/plugin-vue-jsx';
import dotenv from 'dotenv';
import AutoImport from 'unplugin-auto-import/vite';
import { defineConfig } from 'vite';
import { isCypressTestEnv, testConfig, sslConfig, useSSL } from './config';
/**
* Resolve given directory path as an absolute path relative to the cwd
*/
export const resolveAbsolute = (dir: string) => resolve(__dirname, dir);
export default () => {
dotenv.config({ path: './.env' });
return defineConfig({
base: '/',
build: {
// < limit to base64 string
assetsInlineLimit: 10000,
rollupOptions: {
plugins: [],
// ensure we have the same module exports after chunking our bundle
preserveEntrySignatures: 'strict'
}
},
// pre-bundle the following inclusions
optimizeDeps: {
include: ['vue', 'pinia', 'vue-router']
},
plugins: [
/* Vue */
Vue(),
/* Auto-import the following modules as compiler macros */
AutoImport({
dts: 'src/auto-imports.d.ts',
imports: ['vue', 'vue-router']
}),
/* JSX Support */
jsx({
// options are passed on to @vue/babel-plugin-jsx
})
],
/* Alias Resolution */
resolve: {
alias: {
'@': resolveAbsolute('./src')
}
},
server: {
open: false,
...(isCypressTestEnv || !useSSL ? testConfig : sslConfig())
}
});
};