-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.ts
59 lines (56 loc) · 1.56 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
import { fileURLToPath, URL } from 'node:url';
import path from 'node:path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import inject from '@rollup/plugin-inject';
import viteBasicSslPlugin from '@vitejs/plugin-basic-ssl';
// import copy from '@rollup-extras/plugin-copy';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
plugins: [
vue(),
viteBasicSslPlugin(),
mode === 'production'
&& inject({
'exclude': 'node_modules/**',
'console.log': path.resolve(__dirname, 'src/shims/console/log.js'),
'console.error': path.resolve(__dirname, 'src/shims/console/error.js'),
'console.warn': path.resolve(__dirname, 'src/shims/console/warn.js'),
}),
],
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
return 'vendor';
}
},
},
},
},
esbuild: {
pure: ['console.debug'],
},
server: {
https: true,
proxy: {
'/proxy/mitre': {
target: 'https://cwe-api.mitre.org/api/v1',
changeOrigin: true,
rewrite: path => path.replace(/^\/proxy\/mitre/, ''),
},
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
// supresses externalized Module warnings
// I think this does something other than intended
// 'source-map-js': 'source-map',
// path: 'path-browserify',
},
},
}));