-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
55 lines (52 loc) · 1.75 KB
/
vite.config.ts
File metadata and controls
55 lines (52 loc) · 1.75 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
import { defineConfig } from 'vite';
import { resolve } from 'path';
// Shared externals — Alpine.js is always external (consumer provides it)
const alpineExternal = ['alpinejs'];
// Collab addon externalizes yjs ecosystem (too large to bundle)
const collabExternals = ['yjs', 'y-protocols', 'y-protocols/awareness', 'y-websocket'];
export default defineConfig({
publicDir: false,
build: {
outDir: 'dist',
emptyOutDir: true,
sourcemap: true,
lib: {
entry: {
// Core ESM (npm / bundlers) — addons built separately via build:addons
'alpineflow.esm': resolve(__dirname, 'lib/core.ts'),
// Core CDN (auto-register via alpine:init)
'alpineflow': resolve(__dirname, 'lib/core.cdn.ts'),
// CDN addon entry points (share chunks, fine for CDN since all files are co-located)
'alpineflow-whiteboard': resolve(__dirname, 'lib/whiteboard.cdn.ts'),
'alpineflow-collab': resolve(__dirname, 'lib/collab.cdn.ts'),
'alpineflow-dagre': resolve(__dirname, 'lib/dagre.cdn.ts'),
'alpineflow-force': resolve(__dirname, 'lib/force.cdn.ts'),
'alpineflow-hierarchy': resolve(__dirname, 'lib/hierarchy.cdn.ts'),
'alpineflow-elk': resolve(__dirname, 'lib/elk.cdn.ts'),
},
formats: ['es'],
},
rollupOptions: {
external: [
...alpineExternal,
...collabExternals,
],
output: {
globals: {
alpinejs: 'Alpine',
},
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') {
return 'alpineflow.css';
}
return assetInfo.name ?? 'assets/[name].[ext]';
},
},
},
},
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
});