-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
63 lines (61 loc) · 1.83 KB
/
vite.config.js
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
/* eslint-disable import/no-extraneous-dependencies */
/// <reference types="vitest" />
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import vitePluginHtmlEnv from './scripts/vite-plugin-html-env'
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = {
...process.env,
...loadEnv(mode, `${process.cwd()}/env/`, ''),
...loadEnv('deploy', `${process.cwd()}/env/`, ''),
...loadEnv('git', `${process.cwd()}/env/`, ''),
}
// import.meta.env.VITE_NAME available here with: process.env.VITE_NAME
// import.meta.env.VITE_PORT available here with: process.env.VITE_PORT
return defineConfig({
plugins: [vitePluginHtmlEnv(), vue()],
// if you need an additional page you have to list them here
// see https://vitejs.dev/guide/build.html#multi-page-app
// build: {
// rollupOptions: {
// input: {
// main: path.resolve(__dirname, 'index.html'),
// murk: path.resolve(__dirname, 'mturk.html'),
// },
// },
// },
envDir: 'env',
base: process.env.VITE_DEPLOY_BASE_PATH,
server: {
port: process.env.VITE_DEV_PORT_NUM,
strictPort: true,
hmr: process.env.GITPOD_WORKSPACE_URL
? {
host: process.env.GITPOD_WORKSPACE_URL.replace('https://', `${process.env.VITE_DEV_PORT_NUM}-`),
protocol: 'wss',
clientPort: 443,
}
: true,
},
test: {
globals: true,
environment: 'happy-dom',
coverage: {
all: true,
src: path.resolve(__dirname, './src'),
reporter: ['text'],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
vue: 'vue/dist/vue.esm-bundler.js',
},
},
define: {
'process.env': process.env,
},
})
}