-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
42 lines (33 loc) · 993 Bytes
/
vite.config.ts
File metadata and controls
42 lines (33 loc) · 993 Bytes
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
import { defineConfig } from 'vite'
import { resolve, dirname } from 'path'
import { fileURLToPath } from 'url'
export default defineConfig({
build: {
// Output to the dist directory
outDir: 'dist',
// Generate source maps
sourcemap: true,
// Don't minify the output
minify: false,
// Configure the library build
lib: {
// The entry point
entry: resolve(dirname(fileURLToPath(import.meta.url)), 'src/index.ts'),
// Output file name
name: 'backchannel',
// Output format - IIFE for script tag usage
formats: ['iife'],
// File name pattern
fileName: () => 'backchannel.js',
},
// Make sure all dependencies are bundled
rollupOptions: {
output: {
// Global variable name for IIFE format
name: 'BackChannel',
// Ensure exports are exposed as properties on the global variable
extend: true,
},
},
},
})