Provide React Native .cjs
workaround in CHANGELOG.md
#9084
Merged
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.
In #8396 (first released in
@apollo/client@3.5.0-beta.0
), we adopted the Node.js recommendation to specify"type": "module"
inpackage.json
, so all.js
modules within the@apollo/client
package will be interpreted (correctly) as ECMAScript modules. Since we also provide various CommonJS bundles for consumption by Node.js and older bundlers, those CommonJS bundles now have a.cjs
file extension, rather than.cjs.js
, so Node.js won't misinterpret them as ECMAScript modules.Unfortunately, as I was first made aware by @SimenB in apollographql/zen-observable-ts#156 (comment), switching to a
.cjs
file extension for CommonJS bundles can cause problems for React Native's Metro bundler. This PR updates ourCHANGELOG.md
to provide guidance on a workaround until facebook/metro#535 is resolved. I wish we could solve this problem unilaterally, but it seems like the React Native / Metro maintainers will have to take action here.