-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
34 lines (29 loc) · 1007 Bytes
/
Copy pathtsup.config.ts
File metadata and controls
34 lines (29 loc) · 1007 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
// tsup.config.ts
//
// Note: this deliberately does not `import { defineConfig } from 'tsup'`.
// Doing so makes tsup bundle itself into the config module, which then fails
// with "Dynamic require of \"fs\" is not supported". A plain object works and
// is type-checked structurally by tsup all the same.
export default {
// Named entries so the output filenames are stable and match package.json's
// "exports" map:
// . -> dist/npm-main.js / dist/npm-main.mjs / dist/npm-main.d.ts
// ./wasm -> dist/wasm.js / dist/wasm.mjs / dist/wasm.d.ts
entry: {
'npm-main': 'src/npm-main.ts',
wasm: 'src/wasm.ts',
},
outDir: 'dist',
format: ['cjs', 'esm'] as ('cjs' | 'esm')[],
target: 'es2020',
dts: true,
clean: true,
// Single-file outputs per entry.
splitting: false,
sourcemap: true,
// .cjs -> .js, .esm -> .mjs
outExtension({ format }: { format: string }) {
if (format === 'esm') return { js: '.mjs' };
return { js: '.js' };
},
};