1
|
|
|
import {defineConfig} from 'vite'; |
2
|
|
|
import {createVuePlugin} from 'vite-plugin-vue2' |
3
|
|
|
import ViteRestart from 'vite-plugin-restart'; |
4
|
|
|
import {viteExternalsPlugin} from 'vite-plugin-externals' |
5
|
|
|
import viteCompression from 'vite-plugin-compression'; |
6
|
|
|
import manifestSRI from 'vite-plugin-manifest-sri'; |
7
|
|
|
import {visualizer} from 'rollup-plugin-visualizer'; |
8
|
|
|
import eslintPlugin from 'vite-plugin-eslint'; |
9
|
|
|
import {nodeResolve} from '@rollup/plugin-node-resolve'; |
10
|
|
|
import * as path from 'path'; |
11
|
|
|
|
12
|
|
|
// https://vitejs.dev/config/ |
13
|
|
|
export default defineConfig(({command}) => ({ |
14
|
|
|
base: command === 'serve' ? '' : '/dist/', |
15
|
|
|
build: { |
16
|
|
|
emptyOutDir: true, |
17
|
|
|
manifest: true, |
18
|
|
|
outDir: '../src/web/assets/dist', |
19
|
|
|
rollupOptions: { |
20
|
|
|
input: { |
21
|
|
|
'alerts': 'src/js/alerts.js', |
22
|
|
|
'dashboard': 'src/js/dashboard.js', |
23
|
|
|
'errors-detail': 'src/js/errors-detail.js', |
24
|
|
|
'errors-index': 'src/js/errors-index.js', |
25
|
|
|
'performance-detail': 'src/js/performance-detail.js', |
26
|
|
|
'performance-index': 'src/js/performance-index.js', |
27
|
|
|
'sidebar': 'src/js/sidebar.js', |
28
|
|
|
'webperf': 'src/js/webperf.js', |
29
|
|
|
}, |
30
|
|
|
output: { |
31
|
|
|
sourcemap: true |
32
|
|
|
}, |
33
|
|
|
} |
34
|
|
|
}, |
35
|
|
|
plugins: [ |
36
|
|
|
nodeResolve({ |
37
|
|
|
moduleDirectories: [ |
38
|
|
|
path.resolve('./node_modules'), |
39
|
|
|
], |
40
|
|
|
}), |
41
|
|
|
ViteRestart({ |
42
|
|
|
reload: [ |
43
|
|
|
'./src/templates/**/*', |
44
|
|
|
], |
45
|
|
|
}), |
46
|
|
|
createVuePlugin(), |
47
|
|
|
viteExternalsPlugin({ |
48
|
|
|
'vue': 'Vue', |
49
|
|
|
}), |
50
|
|
|
viteCompression({ |
51
|
|
|
filter: /\.(js|mjs|json|css|map)$/i |
52
|
|
|
}), |
53
|
|
|
manifestSRI(), |
54
|
|
|
visualizer({ |
55
|
|
|
filename: '../src/web/assets/dist/stats.html', |
56
|
|
|
template: 'treemap', |
57
|
|
|
sourcemap: true, |
58
|
|
|
}), |
59
|
|
|
eslintPlugin({ |
60
|
|
|
cache: false, |
61
|
|
|
}), |
62
|
|
|
], |
63
|
|
|
publicDir: '../src/web/assets/public', |
64
|
|
|
resolve: { |
65
|
|
|
alias: { |
66
|
|
|
'@': path.resolve(__dirname, './src'), |
67
|
|
|
'vue': 'vue/dist/vue.esm.js', |
68
|
|
|
}, |
69
|
|
|
preserveSymlinks: true, |
70
|
|
|
}, |
71
|
|
|
server: { |
72
|
|
|
fs: { |
73
|
|
|
strict: false |
74
|
|
|
}, |
75
|
|
|
host: '0.0.0.0', |
76
|
|
|
origin: 'http://localhost:3001/', |
77
|
|
|
port: 3001, |
78
|
|
|
strictPort: true, |
79
|
|
|
} |
80
|
|
|
})); |
81
|
|
|
|