|
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 {visualizer} from 'rollup-plugin-visualizer'; |
|
7
|
|
|
import {nodeResolve} from '@rollup/plugin-node-resolve'; |
|
8
|
|
|
import * as path from 'path'; |
|
9
|
|
|
|
|
10
|
|
|
// https://vitejs.dev/config/ |
|
11
|
|
|
export default defineConfig(({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
|
|
|
'dashboard': 'src/js/dashboard.js', |
|
20
|
|
|
'content-seo': 'src/js/content-seo.js', |
|
21
|
|
|
'seomatic': 'src/js/seomatic.js', |
|
22
|
|
|
'seomatic-meta': 'src/js/seomatic-meta.js', |
|
23
|
|
|
}, |
|
24
|
|
|
output: { |
|
25
|
|
|
sourcemap: true |
|
26
|
|
|
}, |
|
27
|
|
|
} |
|
28
|
|
|
}, |
|
29
|
|
|
plugins: [ |
|
30
|
|
|
nodeResolve({ |
|
31
|
|
|
moduleDirectories: [ |
|
32
|
|
|
path.resolve('./node_modules'), |
|
33
|
|
|
], |
|
34
|
|
|
}), |
|
35
|
|
|
ViteRestart({ |
|
36
|
|
|
reload: [ |
|
37
|
|
|
'./src/templates/**/*', |
|
38
|
|
|
], |
|
39
|
|
|
}), |
|
40
|
|
|
createVuePlugin(), |
|
41
|
|
|
viteExternalsPlugin({ |
|
42
|
|
|
'vue': 'Vue', |
|
43
|
|
|
}), |
|
44
|
|
|
viteCompression({ |
|
45
|
|
|
filter: /\.(js|mjs|json|css|map)$/i |
|
46
|
|
|
}), |
|
47
|
|
|
visualizer({ |
|
48
|
|
|
filename: '../src/web/assets/dist/stats.html', |
|
49
|
|
|
template: 'treemap', |
|
50
|
|
|
sourcemap: true, |
|
51
|
|
|
}), |
|
52
|
|
|
], |
|
53
|
|
|
optimizeDeps: { |
|
54
|
|
|
include: ['vue-confetti', 'vue-apexcharts', 'vue-axios', '@riophae/vue-treeselect'], |
|
55
|
|
|
}, |
|
56
|
|
|
publicDir: '../src/web/assets/public', |
|
57
|
|
|
resolve: { |
|
58
|
|
|
alias: [ |
|
59
|
|
|
{find: '@', replacement: path.resolve(__dirname, '../src/web/assets/src')}, |
|
60
|
|
|
{find: 'vue', replacement: 'vue/dist/vue.esm.js'}, |
|
61
|
|
|
], |
|
62
|
|
|
preserveSymlinks: true, |
|
63
|
|
|
}, |
|
64
|
|
|
server: { |
|
65
|
|
|
fs: { |
|
66
|
|
|
strict: false |
|
67
|
|
|
}, |
|
68
|
|
|
host: '0.0.0.0', |
|
69
|
|
|
origin: 'http://localhost:3001', |
|
70
|
|
|
port: 3001, |
|
71
|
|
|
strictPort: true, |
|
72
|
|
|
} |
|
73
|
|
|
})); |
|
74
|
|
|
|