Add exports condition and remaining tweaks#339
Open
jerelmiller wants to merge 5 commits intofb/0.10.0from
Open
Add exports condition and remaining tweaks#339jerelmiller wants to merge 5 commits intofb/0.10.0from
exports condition and remaining tweaks#339jerelmiller wants to merge 5 commits intofb/0.10.0from
Conversation
jerelmiller
commented
Dec 12, 2025
| "moduleResolution": "node", | ||
| "lib": ["ES2023", "dom"], | ||
| "module": "NodeNext", | ||
| "moduleResolution": "NodeNext", |
Member
Author
There was a problem hiding this comment.
I updated these to match Apollo Client 🙂
fbartho
approved these changes
Dec 12, 2025
Collaborator
fbartho
left a comment
There was a problem hiding this comment.
Thanks the help @jerelmiller !
| "moduleResolution": "node", | ||
| "lib": ["ES2023", "dom"], | ||
| "module": "NodeNext", | ||
| "moduleResolution": "NodeNext", |
Member
|
From the % npx @arethetypeswrong/cli jerel/tweaks
Need to install the following packages:
@arethetypeswrong/cli@0.18.2
Ok to proceed? (y)
Run `npm pack`? (Pass -P/--pack to skip) (Y/n)
apollo-link-rest v0.10.0-rc.2
Build tools:
- typescript@5.x
- rollup@^4.53.2
⚠️ A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md
🐛 Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug. It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md
🚭 Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
┌───────────────────┬──────────────────────────────┐
│ │ "apollo-link-rest" │
├───────────────────┼──────────────────────────────┤
│ node10 │ 🟢 │
├───────────────────┼──────────────────────────────┤
│ node16 (from CJS) │ ⚠️ ESM (dynamic import only) │
│ │ 🐛 Used fallback condition │
│ │ 🚭 Unexpected module syntax │
├───────────────────┼──────────────────────────────┤
│ node16 (from ESM) │ 🟢 (ESM) │
├───────────────────┼──────────────────────────────┤
│ bundler │ 🟢 │
└───────────────────┴──────────────────────────────┘ |
phryneas
reviewed
Dec 15, 2025
| package.typings = 'index.d.ts'; \ | ||
| package.exports['.'].module = './index.js'; \ | ||
| package.exports['.']['module-sync'] = './index.js'; \ | ||
| package.exports['.'].require = './bundle.umd.js'; \ |
Member
Member
There was a problem hiding this comment.
Or we skip the type: module, and all other files are renamed to mjs.
Collaborator
There was a problem hiding this comment.
Thanks for testing @phryneas! My first reaction is to go with the .cjs extension, because I believe that tagging this with ”type”: “module” is considered best practice & it sounds like an easy fix, but I don’t actually know for sure.
What do you think @jerelmiller ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR does the remaining work from my suggestions in #331 and adds an
exportsfield topackage.jsonto work with modern bundlers.