Skip to content

Typescript ESM CJS references

James Beard edited this page Jan 16, 2024 · 5 revisions

Nextjs fails to detect ESM modules correctly when using exports in package.json

Ran into problem with tsup generating d.ts files with incorrect export section export default blah vs export = blah.

arethetypeswrong reported this as FalseExportDefault

Found a workaround in this tsup issue https://github.com/egoist/tsup/issues/572#issuecomment-1680153238 We may be able to remove "--cjsInterop --splitting" once that is addressed.

AreTheTypesWrong with Andrew Branch

The Modern Guide to Packaging your JavaScript library

Import named default is typed differently than default import (with moduleResolution: node16))

What’s confusing about modules?

Clone this wiki locally