-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.vanilla.js
More file actions
43 lines (40 loc) · 1.18 KB
/
vite.config.vanilla.js
File metadata and controls
43 lines (40 loc) · 1.18 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
/**
* Vite Configuration for Vanilla JS Web Component Bundle
*
* This builds the standalone floating-orb.js that works everywhere
* without React dependencies.
*/
import { defineConfig } from 'vite';
import { resolve } from 'path';
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/floating-orb.js'),
name: 'FloatingOrb',
formats: ['es', 'umd', 'iife'],
fileName: (format) => {
if (format === 'es') return 'floating-orb.esm.js';
if (format === 'umd') return 'floating-orb.umd.js';
if (format === 'iife') return 'floating-orb.min.js';
return `floating-orb.${format}.js`;
},
},
rollupOptions: {
// Don't externalize three.js - bundle it for standalone use
external: [],
output: {
// Global variable name for IIFE/UMD builds
name: 'FloatingOrb',
// Provide global variable names for externalized deps
globals: {},
},
},
outDir: 'dist',
emptyOutDir: false, // Don't clear dist folder (preserve React build)
minify: 'esbuild',
sourcemap: true,
},
define: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
});