-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
73 lines (68 loc) · 2 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// vite.config.js
import { defineConfig, splitVendorChunkPlugin } from 'vite';
import { resolve } from 'path';
import handlebars from 'vite-plugin-handlebars';
function handlebarsOverride(options) {
const plugin = handlebars(options);
// Currently handleHotUpdate skips further processing, which bypasses
// postcss and in turn tailwind doesn't pick up file changes
delete plugin.handleHotUpdate;
return plugin;
}
// Do not add hsah to the file names in production
// Split into multiple chunks both JS and CSS files
// Store JS chunks in the dist/scripts folder
// Store CSS chunks in the dist/styles folder
// Build multi page site
export default defineConfig({
build: {
outDir: 'dist',
assetsInlineLimit: 0,
manifest: true,
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
login: resolve(__dirname, 'login/index.html'),
register: resolve(__dirname, 'register/index.html'),
},
output: {
entryFileNames: 'scripts/[name].js',
chunkFileNames: 'scripts/[name].js',
assetFileNames: 'styles/[name].css',
},
},
minify: 'terser',
sourcemap: false,
emptyOutDir: true,
target: 'esnext',
cssCodeSplit: true,
brotliSize: false,
chunkSizeWarningLimit: 1000,
terserOptions: {
compress: {
keep_infinity: true,
drop_console: true,
},
},
},
plugins: [
splitVendorChunkPlugin(),
handlebarsOverride({
partialDirectory: resolve(__dirname, 'src/partials'),
helpers: {
json: (context) => JSON.stringify(context),
},
}),
],
server: {
watch: {
usePolling: true,
},
host: true,
strictPort: true,
port: 5173,
rewrite: {
auto: true,
},
},
})