feat: make library ESM only + use tsup to bundle library - #140
Merged
Conversation
tsup is no longer actively maintained; tsdown (built on rolldown) is the recommended replacement. This also drops the transitive dependency on esbuild, which resolves a source of outdated dependency alerts. The tsdown config preserves the existing output file names (index.js and index.d.ts for the ESM build, rather than tsdown's default .mjs and .d.mts), so the published package layout is unchanged. The moduleResolution setting was changed from "node" to "bundler" because tsdown only declares its types under an exports field, which the legacy resolver cannot resolve.
The package is only consumed from ESM contexts, so there is no need to ship a CommonJS bundle alongside the ESM one. Since `dist/index.cjs` is no longer produced, the `require` condition is removed from the `exports` map and `main` now points at the ESM bundle. The `module` field is also removed; it only existed to distinguish the ESM bundle from the CommonJS `main`.
Drop the custom `outExtensions` in favor of the tsdown defaults, so the bundle is emitted as `index.mjs` with types in `index.d.mts`. The `main`, `types`, and `exports` fields are updated to match, as is the import in the `docs-builder` CLI script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #138
See issue for details.