Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide React Native .cjs workaround in CHANGELOG.md #9084

Merged
merged 2 commits into from
Nov 19, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Nov 18, 2021

In #8396 (first released in @apollo/client@3.5.0-beta.0), we adopted the Node.js recommendation to specify "type": "module" in package.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 our CHANGELOG.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.

@benjamn benjamn self-assigned this Nov 18, 2021
@benjamn benjamn added this to the v3.5.x patch releases milestone Nov 18, 2021
@productdevbook
Copy link

some problem fixed ? #9048

This is a helpful link: https://v3.nuxtjs.org/concepts/esm

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @benjamn!

@benjamn benjamn merged commit 3771b68 into main Nov 19, 2021
@benjamn benjamn deleted the react-native-metro-cjs-workaround branch November 19, 2021 17:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants