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