forked from onedarnleyroad/craftcms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
49 lines (48 loc) · 1.12 KB
/
vite.config.js
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
import {defineConfig} from 'vite';
import manifestSRI from 'vite-plugin-manifest-sri';
import path from 'path';
import viteCompression from 'vite-plugin-compression';
import ViteRestart from 'vite-plugin-restart';
// https://vitejs.dev/config/
export default defineConfig(({command}) => ({
base: command === 'serve' ? '' : '/dist/',
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
manifest: true,
outDir: path.resolve(__dirname, 'web/dist/'),
rollupOptions: {
input: {
app: path.resolve(__dirname, 'src/js/app.js'),
},
output: {
sourcemap: true
},
},
},
plugins: [
manifestSRI(),
viteCompression({
filter: /\.(js|mjs|json|css|map)$/i
}),
ViteRestart({
reload: [
'templates/**/*',
],
}),
],
publicDir: path.resolve(__dirname, 'src/public'),
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@css': path.resolve(__dirname, 'src/pcss'),
'@js': path.resolve(__dirname, 'src/js'),
},
},
server: {
host: '0.0.0.0',
port: 3000,
strictPort: true,
},
}));