-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite.config.ts
66 lines (65 loc) · 1.56 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
import {defineConfig} from 'vite';
import createVuePlugin from '@vitejs/plugin-vue';
import viteCompressionPlugin from 'vite-plugin-compression';
import viteEslintPlugin from 'vite-plugin-eslint';
import viteStylelintPlugin from 'vite-plugin-stylelint';
import viteRestartPlugin from 'vite-plugin-restart';
import {visualizer} from 'rollup-plugin-visualizer';
import * as path from 'path';
// https://vitejs.dev/config/
export default defineConfig(({command}) => ({
base: command === 'serve' ? '' : '/dist/',
build: {
emptyOutDir: true,
manifest: 'manifest.json',
outDir: '../src/web/assets/dist',
rollupOptions: {
input: {
app: 'src/js/app.ts',
welcome: 'src/js/welcome.ts',
},
output: {
sourcemap: true
},
}
},
plugins: [
viteRestartPlugin({
reload: [
'../src/templates/**/*',
],
}),
createVuePlugin(),
viteCompressionPlugin({
filter: /\.(js|mjs|json|css|map)$/i
}),
visualizer({
filename: '../src/web/assets/dist/stats.html',
template: 'treemap',
sourcemap: true,
}),
viteEslintPlugin({
cache: false,
fix: true,
}),
viteStylelintPlugin({
fix: true,
lintInWorker: true
})
],
resolve: {
alias: [
{find: '@', replacement: path.resolve(__dirname, './src')},
],
preserveSymlinks: true,
},
server: {
fs: {
strict: false
},
host: '0.0.0.0',
origin: 'http://localhost:' + process.env.DEV_PORT,
port: parseInt(process.env.DEV_PORT),
strictPort: true,
}
}));