Files
ui/pkgs/event/tsup.config.ts
zeekay ce5c1434f1 fix(event): emit CJS as .cjs so require() works under type:module
The 0.3.0 CJS bundle went to dist/index.js, which Node parses as ESM under
"type": "module" — require('@hanzo/event') threw "exports is not defined in
ES module scope". Emit CJS as .cjs (ESM stays .mjs) and map each exports
condition to its own types. No API change. Bumps 0.3.0 -> 0.3.1.
2026-07-22 22:04:20 -07:00

21 lines
602 B
TypeScript

import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/index.ts', 'src/react.tsx'],
format: ['cjs', 'esm'],
dts: true,
clean: true,
external: ['react'],
minify: false,
sourcemap: true,
splitting: false,
treeshake: true,
tsconfig: 'tsconfig.json',
// Explicit extensions so the module format is unambiguous under
// `"type": "module"`: CJS is `.cjs` (a `.js` here would be read as ESM and
// crash `require()` with "exports is not defined"), ESM is `.mjs`.
outExtension({ format }) {
return { js: `.${format === 'cjs' ? 'cjs' : 'mjs'}` }
},
})