-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
85 lines (73 loc) · 1.88 KB
/
vite.config.js
File metadata and controls
85 lines (73 loc) · 1.88 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
import { defineConfig } from 'vite';
import { resolve } from 'path';
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/resources/js/fa-wired.js'),
name: 'FaWired',
fileName: (format) => {
switch (format) {
case 'es':
return 'fa-wired.esm.js';
case 'umd':
return 'fa-wired.umd.js';
case 'iife':
return 'fa-wired.js';
default:
return `fa-wired.${format}.js`;
}
},
formats: ['es', 'umd', 'iife']
},
rollupOptions: {
// External dependencies that shouldn't be bundled
external: ['alpinejs'],
output: {
globals: {
'alpinejs': 'Alpine'
},
// Add banner with version and build info
banner: `/*!
* fa-wired v${process.env.npm_package_version || '1.0.0'}
* Fathom Analytics Alpine.js wrapper for Laravel/Livewire
* (c) ${new Date().getFullYear()} kerkness
* Released under the MIT License
* https://github.com/kerkness/fa-wired
*/`
}
},
// Generate source maps
sourcemap: true,
// Minification options
minify: 'terser',
terserOptions: {
compress: {
drop_console: false, // Keep console.warn for debugging
drop_debugger: true
},
format: {
comments: /^!/
}
},
// Output directory
outDir: 'dist',
// Clear output directory before build
emptyOutDir: true,
// Generate manifest
manifest: true
},
// Development server options
server: {
port: 3000,
open: false
},
// Preview server options
preview: {
port: 4173
},
// Define environment variables
define: {
__VERSION__: JSON.stringify(process.env.npm_package_version || '1.0.0'),
__BUILD_DATE__: JSON.stringify(new Date().toISOString())
}
});