-
Notifications
You must be signed in to change notification settings - Fork 24
/
vite.config.js
68 lines (66 loc) · 2.34 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
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';
// Determine if we are in development mode
const isDevelopment = process.env.NODE_ENV === 'local';
export default defineConfig({
plugins: [
laravel([
'resources/css/tailwind.css',
'resources/js/app.ts',
'resources/js/admin-app.ts',
'resources/js/shop-component.ts',
'resources/js/player-event-calendar-component.ts',
'resources/js/guide-quests-init.tsx',
'resources/js/items-table-component.ts',
'resources/js/online-character-stats-component.ts',
'resources/js/vendor/theme-script.js',
'resources/vendor/theme/assets/js/dark-mode/dark-mode.js',
'resources/js/vendor/livewire-data-tables.js',
'resources/js/vendor/livewire.js',
]),
react(),
],
optimizeDeps: {
esbuildOptions: {
tsconfig: 'tsconfig.json'
}
},
resolve: {
alias: {
'@mui': '/node_modules/@mui',
},
},
build: {
minify: !isDevelopment,
sourcemap: isDevelopment,
inlineDynamicImports: !isDevelopment,
terserOptions: {
compress: {
drop_console: !isDevelopment,
},
},
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
manualChunks(id) {
const match = id.match(/node_modules\/([^/]+)/);
if (match) {
const packageName = match[1];
if (id.includes('node_modules/')) {
return `vendor_${packageName}`;
} else {
// Specify specific packages to group into smaller chunks
if (packageName === 'date-fns') {
return 'date_fns'; // Group date-fns into a separate chunk
}
if (packageName.startsWith('game-related-package')) {
return 'game'; // Group game-related packages into a separate chunk
}
}
}
},
},
},
},
});