Skip to content

Conversation

TrevorBurnham
Copy link

This commit switches to tsup to build from TypeScript instead of using tsc directly, and defines additional entrypoints in package.json.

This fixes some complaints about the built types that arethetypeswrong reported, ensuring compatibility with all consumers.

Before

$ npx --yes @arethetypeswrong/cli --pack .

🤨 CommonJS module simulates a default export with exports.default and exports.__esModule, but does not also set module.exports for compatibility with Node. Node, and some bundlers under certain conditions (https://andrewbranch.github.io/interop-test/#synthesizing-default-exports-for-cjs-modules), do not respect the __esModule marker, so accessing the intended default export will require a .default property access on the default import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSOnlyExportsDefault.md

┌───────────────────┬───────────────────────┬──────────────────────┬─────────────────────────────────┐
│                   │ "next-router-mock""next-router-mock/*""next-router-mock/package.json" │
├───────────────────┼───────────────────────┼──────────────────────┼─────────────────────────────────┤
│ node10            │ 🟢                    │ (wildcard)           │ 🟢 (JSON)                       │
├───────────────────┼───────────────────────┼──────────────────────┼─────────────────────────────────┤
│ node16 (from CJS) │ 🟢 (CJS)              │ (wildcard)           │ 🟢 (JSON)                       │
├───────────────────┼───────────────────────┼──────────────────────┼─────────────────────────────────┤
│ node16 (from ESM) │ 🤨 CJS default export │ (wildcard)           │ 🟢 (JSON)                       │
├───────────────────┼───────────────────────┼──────────────────────┼─────────────────────────────────┤
│ bundler           │ 🤨 CJS default export │ (wildcard)           │ 🟢 (JSON)                       │
└───────────────────┴───────────────────────┴──────────────────────┴─────────────────────────────────┘

After

$ npx --yes @arethetypeswrong/cli --pack .

 No problems found 🌟

"next-router-mock"

node10: 🟢 
node16 (from CJS): 🟢 (CJS)
node16 (from ESM): 🟢 (CJS)
bundler: 🟢 

"next-router-mock/*"

node10: (wildcard)
node16 (from CJS): (wildcard)
node16 (from ESM): (wildcard)
bundler: (wildcard)

"next-router-mock/package.json"

node10: 🟢 (JSON)
node16 (from CJS): 🟢 (JSON)
node16 (from ESM): 🟢 (JSON)
bundler: 🟢 (JSON)

Copy link

changeset-bot bot commented Aug 31, 2025

⚠️ No Changeset found

Latest commit: cfe449c

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

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.

1 participant