-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
40 lines (36 loc) · 944 Bytes
/
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
import { PluginOption, defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import SSL from '@vitejs/plugin-basic-ssl';
/**
* Add any plugins that are shared with Dev & Production Mode Here
* @type {*} */
const defaultPlugins = [vue()];
/**
* Used to check if the flag --dev has been passed through the startup process.
*
* @return {boolean}
*/
function isDev(): boolean {
const args = process.argv;
return typeof args.find((x) => x.includes('--dev')) !== 'undefined';
}
/**
* Build plugin list for development mode, and production mode.
*
* @return {PluginOption[]}
*/
function buildPluginList(): PluginOption[] {
return isDev() ? [...defaultPlugins, SSL()] : defaultPlugins;
}
export default defineConfig({
plugins: buildPluginList(),
server: {
host: 'localhost',
https: true,
port: 3000,
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
});