-
Notifications
You must be signed in to change notification settings - Fork 37
/
vite.config.ts
70 lines (68 loc) · 1.73 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
67
68
69
70
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import autoprefixer from 'autoprefixer'
import { createHtmlPlugin } from 'vite-plugin-html'
import { visualizer } from 'rollup-plugin-visualizer'
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
const basePath = process.env.NODE_ENV !== 'production' || process.env.DISABLE_BASE_PATH === 'true' ? '/' : '/__km_base__/'
// https://vitejs.dev/config/
export default defineConfig({
base: basePath,
resolve: {
alias: [
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
},
{
find: 'config',
replacement: path.resolve(__dirname, 'src/config'),
},
],
},
plugins: [
vue(),
createHtmlPlugin({
minify: false,
inject: {
data: {
basePath,
},
},
}),
// See: https://github.com/vdesjs/vite-plugin-monaco-editor/issues/21
// eslint-disable-next-line @typescript-eslint/no-explicit-any
((monacoEditorPlugin as any).default as typeof monacoEditorPlugin)({
languageWorkers: ['editorWorkerService'],
}),
visualizer({
filename: path.resolve(__dirname, 'bundle-analyzer/stats-treemap.html'),
template: 'treemap', // sunburst|treemap|network
gzipSize: true,
brotliSize: true,
}),
],
server: {
proxy: {
'/kconfig.js': process.env.KONG_GUI_URL || 'http://127.0.0.1:8002',
},
port: 8080,
},
preview: {
port: 8080,
},
css: {
preprocessorOptions: {
scss: {
api: 'modern',
additionalData: '@use "@kong/design-tokens/tokens/scss/variables" as *;',
},
},
postcss: {
plugins: [
autoprefixer,
],
},
},
})