mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 13:51:19 +00:00
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.
21 lines
602 B
TypeScript
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'}` }
|
|
},
|
|
})
|