-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
55 lines (52 loc) · 1.62 KB
/
Copy pathtsdown.config.ts
File metadata and controls
55 lines (52 loc) · 1.62 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 'tsdown'
const ID = '@dsh-external/dsh-client-ui-rollback-visual'
// Resolved from the loader's frozen module table at runtime, never inlined.
const EXTERNALS = [
'react',
'react/jsx-runtime',
'react-dom',
'react-dom/client',
'@deepseek-ai/cordis',
]
export default defineConfig([
// Host (node) half: imported by the harness Loader; no behavior.
{
name: ID,
entry: ['src/index.ts'],
outDir: 'lib',
format: ['esm'],
platform: 'node',
target: 'es2024',
dts: false,
clean: false,
fixedExtension: false,
sourcemap: false,
external: ['@deepseek-ai/cordis'],
},
// Client (browser) half: closure-factory artifact handed to
// window.__ModuleLoader__.load({ id, factory }); externals resolve through
// the injected require from the loader module table.
{
name: `${ID}/client`,
entry: { client: 'src/client/index.ts' },
outDir: 'lib',
format: 'cjs',
platform: 'browser',
target: 'es2022',
dts: false,
clean: false,
sourcemap: true,
external: EXTERNALS,
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
'import.meta.env.MODE': JSON.stringify(process.env.NODE_ENV ?? 'production'),
'import.meta.env': JSON.stringify({ MODE: process.env.NODE_ENV ?? 'production' }),
},
outputOptions: {
entryFileNames: 'client.js',
banner: `window.__ModuleLoader__.load({ id: ${JSON.stringify(ID)}, factory: (require) => {`,
footer: 'return module.exports; } });',
intro: 'var module = { exports: {} }; var exports = module.exports;',
},
},
])