-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtsup.browser.config.ts
More file actions
46 lines (45 loc) · 1.48 KB
/
Copy pathtsup.browser.config.ts
File metadata and controls
46 lines (45 loc) · 1.48 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
import { defineConfig } from 'tsup'
export default defineConfig({
entry: {
// Complete browser bundle with everything
'spytial-core-complete': 'src/index.ts'
},
format: ['iife'], // Immediately Invoked Function Expression for browser
globalName: 'spytialcore', // Global variable name for the complete library
dts: false, // No TypeScript definitions for browser bundle
splitting: false,
sourcemap: true,
clean: false, // Don't clean dist folder (preserve other builds)
minify: true,
target: 'es2020',
outDir: 'dist/browser',
external: ['react', 'react-dom'], // Bundle everything, except React
bundle: true,
treeshake: true,
// Create backward-compatible aliases for the global name
footer: {
js: 'if(typeof window!=="undefined"){const componentApi=window.spytialComponents||window.CnDComponents||window.CndComponents;if(componentApi&&typeof componentApi==="object"){Object.assign(window.spytialcore,componentApi);}window.CndCore=window.spytialcore;window.CnDCore=window.spytialcore;}',
},
// Bundle ALL dependencies for browser use
noExternal: [
'graphlib',
'graphlib-dot',
'kiwi.js',
'chroma-js',
'js-yaml',
'lodash',
'@xmldom/xmldom',
'forge-expr-evaluator',
'd3',
'webcola',
'dagre',
'simple-graph-query'
],
// Define global variables for browser environment
define: {
'process.env.NODE_ENV': '"production"',
'global': 'globalThis'
},
// Ensure DOM types are available
platform: 'browser',
})