Skip to content

chore(repo): Update rolldown and tsdown#8207

Open
dstaley wants to merge 3 commits intods.chore/ts-6.0from
ds.chore/ts-6.0-rolldown-update
Open

chore(repo): Update rolldown and tsdown#8207
dstaley wants to merge 3 commits intods.chore/ts-6.0from
ds.chore/ts-6.0-rolldown-update

Conversation

@dstaley
Copy link
Copy Markdown
Member

@dstaley dstaley commented Mar 31, 2026

Description

Update tsdown and rolldown to their latest versions. This surfaced several issues with our type system, which have been resolved in this PR:

  1. We're now only building one type tree for @clerk/shared, using tsc instead of bundling types with tsdown. This prevents issues where the same type was pulled from dist/types and dist/runtime.
  2. To support emitting types with tsc, the @/ path alias was removed in favor of relative imports. We can explore using "imports" in package.json in a future PR if we know that every runtime @clerk/shared supports has support for that.
  3. Fixed an issue with CJS type resolution in @clerk/react by pointing the "require" "types" field to the emitted CJS type bundle (which has been updated to simply re-export the exports of the ESM version)
  4. Marked @clerk/ui/internal as an external in the tsdown config for @clerk/react, which prevents it from being bundled in. Now, all use of the type resolves to @clerk/ui, preventing issues where there's two versions of the same type.
  5. Updates turbo.json to factor in tsdown.config.mts into whether or not to invalidate the cache.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: 357160b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Error Error Mar 31, 2026 5:13pm

Request Review

"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
"types": "./dist/index.d.cts",
Copy link
Copy Markdown
Member Author

@dstaley dstaley Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it's somewhat strange that tsdown emits both mts and cts files. I would have thought that the CJS files would be js since the package doesn't have "type": "module". After looking into the config for tsdown it does appear that this is to be expected though. When you emit a cjs bundle, tsdown defaults platform to "node", which forces the fixedExtensions config to be true. So it does seem like this is intentional for dual ESM+CJS packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant