tsup.config.ts
tsup.config.ts
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/index.ts'], // , 'src/cli.ts'],
shims: true,
format: ['cjs', 'esm'],
clean: true,
dts: true,
// https://github.com/egoist/tsup/pull/1056
// https://github.com/egoist/tsup/issues?q=cjsInterop
cjsInterop: true,
splitting: true,
outExtension({ format }) {
return {
js: `.${format === 'esm' ? 'mjs' : 'cjs'}`,
}
},
})