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