Skip to content

Commit 3ab4dcd

Browse files
committed
Update readme details about ESM.
1 parent 37086df commit 3ab4dcd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Separately limit tests, with the universal ESM and CJS set to a 3 KB maximum size.
2222
- Removed redundant ESLint disable comments.
2323
- Also run GitHub Actions with Node.js v14.
24+
- Updated readme details about ESM.
2425

2526
## 10.0.0
2627

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ A < 3 KB bundle impact is guaranteed by [Size Limit](https://github.com/ai/si
653653
| --- | --- | --- |
654654
| [`graphql-react`](https://npm.im/graphql-react) | [![graphql-react install size](https://badgen.net/packagephobia/install/graphql-react)](https://packagephobia.now.sh/result?p=graphql-react) | [![graphql-react minzipped size](https://badgen.net/bundlephobia/minzip/graphql-react)](https://bundlephobia.com/result?p=graphql-react) |
655655
656-
[Tree shaking](https://developer.mozilla.org/docs/Glossary/Tree_shaking) bundlers will eliminate unused exports (perhaps [`reportCacheErrors`](#function-reportcacheerrors)).
656+
The bundle impact may be smaller, depending on how much of the API you use.
657657
658658
#### Apollo
659659
@@ -669,15 +669,15 @@ Several dependencies must be installed for a minimal Apollo project.
669669
670670
In addition, [fragment matcher](https://www.apollographql.com/docs/react/advanced/fragments#fragment-matcher) config impacts bundle size relative to the number and complexity of schema unions and interfaces; see [**_Cache strategy_**](#cache-strategy).
671671
672-
### Native ESM
672+
### ESM
673673
674674
#### graphql-react
675675
676-
Supports native ESM via `.mjs` files for Node.js in [`--experimental-modules`](https://nodejs.org/api/esm.html#esm_enabling) mode and [tree shaking](https://developer.mozilla.org/docs/Glossary/Tree_shaking) bundlers like [webpack](https://webpack.js.org). For legacy environments CJS is provided via `.js` files.
676+
Supports [ESM in Node.js](https://nodejs.org/api/esm.html) whilst avoiding the [dual package hazard](https://nodejs.org/api/esm.html#esm_dual_package_hazard) via [ESM wrappers around CJS](https://nodejs.org/api/esm.html#esm_approach_1_use_an_es_module_wrapper) and [`package.json` `exports` field conditional exports](https://nodejs.org/api/esm.html#esm_conditional_exports).
677677
678678
#### Apollo
679679
680-
No support for native ESM, although they do provide faux ESM via package `module` fields for [tree shaking](https://developer.mozilla.org/docs/Glossary/Tree_shaking) bundlers like [webpack](https://webpack.js.org).
680+
Faux ESM that can’t be used by Node.js is provided via package `module` fields for [tree shaking](https://developer.mozilla.org/docs/Glossary/Tree_shaking) bundlers like [webpack](https://webpack.js.org).
681681
682682
### Writing queries
683683

0 commit comments

Comments
 (0)