forked from JLyne/LiveAtlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
52 lines (48 loc) · 1.26 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
// noinspection JSUnusedGlobalSymbols
import {defineConfig, loadEnv} from 'vite';
import { resolve } from 'path';
import vue from '@vitejs/plugin-vue';
import svgSpritePlugin from "vite-plugin-svg-sprite-component";
import analyze from 'rollup-plugin-analyzer';
import { splitVendorChunkPlugin } from 'vite'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
// expose .env as process.env instead of import.meta since jest does not import meta yet
const envWithProcessPrefix = Object.entries(env).reduce(
(prev, [key, val]) => {
return {
...prev,
['process.env.' + key]: `"${val}"`,
}
},
{},
);
return {
plugins: [splitVendorChunkPlugin(), vue(), analyze(), svgSpritePlugin({
symbolId: (name) => `icon--${name}`,
removeAttrs: ['xmlns', 'width', 'height', 'version']
})],
base: './',
server: {
host: '0.0.0.0',
port: 8080
},
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, 'src')
}
]
},
build: {
chunkSizeWarningLimit: 600,
assetsDir: 'live-atlas/assets'
},
define: envWithProcessPrefix,
test: {
globals: true,
environment: 'jsdom',
},
}
});