Skip to content

fix: serve .d.cts to CJS consumers#546

Merged
Luca Schneider (Mad-Kat) merged 3 commits into
mainfrom
fix/cjs-types-exports
May 6, 2026
Merged

fix: serve .d.cts to CJS consumers#546
Luca Schneider (Mad-Kat) merged 3 commits into
mainfrom
fix/cjs-types-exports

Conversation

@Mad-Kat

Copy link
Copy Markdown
Collaborator

Fixes a regression in #531: CJS consumers using Node16/NodeNext module resolution can no longer import next-yak and get a TS1479:

error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; 
however, the referenced file is an ECMAScript module and cannot be imported with 'require'.

Cause

TypeScript matches exports conditions in order, so "types" is selected for every consumer. Before #531, exports had no "types" condition at all and TypeScript fell back to adjacent file matching.

The fix is to use the canonical dual-package pattern.

@changeset-bot

changeset-bot Bot commented May 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49d021f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
next-yak Patch
storybook-addon-yak Patch
next-yak-example Patch
@example/storybook Patch
vite-yak-example Patch
benchmarks Patch
docs Patch
yak-swc Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🧪 Example preview: https://next-o96i0rxj6-jan-nicklas-projects.vercel.app
Built from 49d021f

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

📚 Docs preview: https://next-yak-docs-rjlhbz7vh-jan-nicklas-projects.vercel.app
Built from 49d021f

@Mad-Kat Luca Schneider (Mad-Kat) marked this pull request as ready for review May 6, 2026 06:55
@Mad-Kat Luca Schneider (Mad-Kat) merged commit 14cbb13 into main May 6, 2026
7 checks passed
@Mad-Kat Luca Schneider (Mad-Kat) deleted the fix/cjs-types-exports branch May 6, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant