fork of hey-api/openapi-ts because I need some additional things
1import { defineConfig } from 'tsdown';
2
3export default defineConfig((options) => ({
4 banner(ctx) {
5 /**
6 * fix dynamic require in ESM
7 * @link https://github.com/hey-api/openapi-ts/issues/1079
8 */
9 if (ctx.format === 'esm') {
10 return {
11 js: `import { createRequire } from 'module'; const require = createRequire(import.${'meta'}.url);`,
12 };
13 }
14
15 return;
16 },
17 clean: true,
18 dts: true,
19 entry: ['src/index.ts'],
20 format: ['cjs', 'esm'],
21 minify: !options.watch,
22 shims: false,
23 sourcemap: true,
24 treeshake: true,
25}));