-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
42 lines (33 loc) · 975 Bytes
/
tsup.config.ts
File metadata and controls
42 lines (33 loc) · 975 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
/*
// tsup.config.ts
import { defineConfig } from 'tsup'
export default defineConfig({
// Provide a named entry so we can control final filenames
entry: {
'npm-main': 'src/npm-main.ts', // or wherever your main code resides
},
outDir: 'build',
// We'll produce both CJS and ESM
format: ['cjs', 'esm'],
// If you want to run on both Node + modern JS runtimes
// (or set "target": "esnext" if you know your audience)
target: 'es2020',
// Generate types
dts: {
entry: 'src/npm-main.ts'
},
// Removes old build files before each build
clean: true,
// Avoid code splitting so we get single-file outputs
splitting: false,
// Optionally create source maps
sourcemap: true,
// Rename outputs based on their format
// so .cjs → .js and .esm → .mjs
outExtension({ format }) {
if (format === 'cjs') return { js: '.js' }
if (format === 'esm') return { js: '.mjs' }
return { js: '.js' } // fallback
},
})
*/