forked from betagouv/figpot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
26 lines (24 loc) · 958 Bytes
/
tsup.config.ts
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
import path from 'path';
import { defineConfig } from 'tsup';
const entryPattern = path.resolve(__dirname, 'src/index.ts');
const cliPattern = path.resolve(__dirname, 'src/cli/index.ts');
export default defineConfig((options) => {
return {
entry: [entryPattern, cliPattern],
outDir: 'dist',
// Librairies like `change-case` are ESM-only and cannot be imported from a CJS package, so we decided to only package the ESM format
// It should be fine since `figpot` is intended to be used as a CLI, and not directly imported into third-party code
// Other formats can be reconsidered once Node v22 has more traction, since from this version it's allowed for CJS to import ESM modules
format: ['esm'],
// format: ['cjs', 'esm', 'iife'],
globalName: 'Figpot',
minify: !options.watch,
splitting: true,
split: [],
dts: true,
sourcemap: true,
shims: true,
clean: true,
async onSuccess() {},
};
});