Skip to content

Conversation

@jackmisner
Copy link
Owner

@jackmisner jackmisner commented Jan 22, 2026

  • Replace separate ESM/CJS/types builds with tsup which handles all three in a single step and properly bundles code without relative import issues.

  • This fixes ESM module resolution errors when importing from projects that use Node.js ESM (missing .js extensions on relative imports).

Summary by CodeRabbit

  • Chores
    • Refactored build system for improved efficiency and maintainability.
    • Standardised package distribution paths across all export formats.

✏️ Tip: You can customize this high-level summary in your review settings.

- Replace separate ESM/CJS/types builds with tsup which handles all three in a single step and properly bundles code without relative import issues.

- This fixes ESM module resolution errors when importing from projects that use Node.js ESM (missing .js extensions on relative imports).
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

The build system is migrated from separate build scripts for ESM, CommonJS, and type declarations to a unified tsup-based builder. Package exports are restructured to use a flatter directory layout with explicit file extensions (.cjs, .js, .d.ts, .d.cts).

Changes

Cohort / File(s) Summary
Build Configuration
tsup.config.ts
New tsup configuration file defining entry points (src/index.ts, src/react/index.ts), dual format output (ESM and CommonJS), type declaration generation, sourcemap output, and tree-shaking with external React dependencies.
Package Configuration
package.json
Updated main, module, and types fields to point to new flat dist paths. Exports map restructured: root and ./react entries now map directly to dist files using .cjs and .js extensions rather than nested cjs/esm/types directories. Build scripts consolidated into single tsup invocation; build:esm, build:cjs, and build:types removed. Added tsup as devDependency.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: replacing the build tool from tsc to tsup, which is the primary objective of this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@jackmisner jackmisner merged commit 5dde40f into main Jan 22, 2026
5 checks passed
@jackmisner jackmisner deleted the add-tsup-dev-dependency-for-proper-build-bundling branch January 22, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants