Skip to content

fix: add dual CJS/ESM package exports for Vite 8 interop#134

Merged
andrii-bodnar merged 1 commit into
mainfrom
fix/vite8-cjs-interop-dual-build
Apr 21, 2026
Merged

fix: add dual CJS/ESM package exports for Vite 8 interop#134
andrii-bodnar merged 1 commit into
mainfrom
fix/vite8-cjs-interop-dual-build

Conversation

@andrii-bodnar

Copy link
Copy Markdown
Member

Switch build to tsup and publish both CJS and ESM entrypoints via exports/import/require fields. This preserves existing CommonJS usage while fixing default-import behavior in Vite 8/Rolldown environments.

Comment thread package.json
"jest-circus": "^29.5.0",
"jest-junit": "^15.0.0",
"lint-staged": ">=13",
"tsup": "^8.5.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

on tsup page :
[!WARNING] This project is not actively maintained anymore. Please consider using tsdown instead. Read more in the migration guide.

It's ok for you to use it ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

tsdown requires Node 20+, so we'll need to bump the Node version as well. Technically, it's a breaking change

@Brezinben Brezinben left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Work for me :) thanks

@andrii-bodnar

Copy link
Copy Markdown
Member Author

@Brezinben thank you! What do you think about the idea of moving ESM-only?

@Brezinben

Copy link
Copy Markdown

@Brezinben thank you! What do you think about the idea of moving ESM-only?

For major version can be good, maybe after minimal node version >= 20

@andrii-bodnar

Copy link
Copy Markdown
Member Author

Yes, it would be a v3 release with ESM-only support, and increased minimal version of Node to 22.19 (which supports require(ESM))

@andrii-bodnar
andrii-bodnar merged commit 9fdec28 into main Apr 21, 2026
7 checks passed
@andrii-bodnar
andrii-bodnar deleted the fix/vite8-cjs-interop-dual-build branch April 21, 2026 08:28
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.

"default" import broken with Vite 8 (Rolldown) due to missing ESM interop (__esModule)

2 participants