-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[SDK 50][expo-web] @apollo-client
fails during expo export
with metro for web
#25965
Comments
Thank you for filing this issue! |
@EvanBacon Issue appears to stem from this line https://github.com/apollographql/apollo-client/blob/f92db4e809e113000b30fc081b7cf1648efe3446/src/utilities/globals/index.ts#L18 |
It's actually line 19 that is causing the problem: The export of |
Any resolution to this? |
This is really gross 😅 but a stop gap is adding the below function to a
in package.json, something like:
|
I recommend the following package: (if you're using yarn, upgrade to yarn 4 and that has built in support for patches - no need for additional packages). |
…#1195) Summary: We've encountered this as part of a report on the `expo` repo: expo/expo#25965 There, an issue is caused by a dependency using an export alias named `__DEV__`, which the `inlinePlugin` is trying to replace: ```js export { DEV as __DEV__ }; ``` This only occurs in certain cases, since usually, as part of the iOS/Android builds, we would be applying the `inlinePlugin` only after export statements, where this issue may occur, have been transpiled away. However, looking at this issue, I found more cases that would fail with the current implementation of the `inlinePlugin`. This is part of what I added in tests but not an exhaustive list: - Shorthand object methods (`{ __DEV__() {} }`) - Labelled statements (`__DEV__: {};`) - Class methods (`class { __DEV__() {} }`) - Optional property member access (`x?.__DEV__`) All of these issues can be addressed by letting this replacement use `ReferencedIdentifier` as a visitor, rather than just `Identifier`. Pull Request resolved: #1195 Test Plan: - Tests have been added to `inline-plugin-test.js` to reflect the mentioned cases. Reviewed By: huntie Differential Revision: D52909519 Pulled By: motiz88 fbshipit-source-id: 37a6459bc917701fe8474c33ccae41cb484e92f0
…#1195) Summary: We've encountered this as part of a report on the `expo` repo: expo/expo#25965 There, an issue is caused by a dependency using an export alias named `__DEV__`, which the `inlinePlugin` is trying to replace: ```js export { DEV as __DEV__ }; ``` This only occurs in certain cases, since usually, as part of the iOS/Android builds, we would be applying the `inlinePlugin` only after export statements, where this issue may occur, have been transpiled away. However, looking at this issue, I found more cases that would fail with the current implementation of the `inlinePlugin`. This is part of what I added in tests but not an exhaustive list: - Shorthand object methods (`{ __DEV__() {} }`) - Labelled statements (`__DEV__: {};`) - Class methods (`class { __DEV__() {} }`) - Optional property member access (`x?.__DEV__`) All of these issues can be addressed by letting this replacement use `ReferencedIdentifier` as a visitor, rather than just `Identifier`. Pull Request resolved: #1195 Test Plan: - Tests have been added to `inline-plugin-test.js` to reflect the mentioned cases. Reviewed By: huntie Differential Revision: D52909519 Pulled By: motiz88 fbshipit-source-id: 37a6459bc917701fe8474c33ccae41cb484e92f0
…#1195) Summary: We've encountered this as part of a report on the `expo` repo: expo/expo#25965 There, an issue is caused by a dependency using an export alias named `__DEV__`, which the `inlinePlugin` is trying to replace: ```js export { DEV as __DEV__ }; ``` This only occurs in certain cases, since usually, as part of the iOS/Android builds, we would be applying the `inlinePlugin` only after export statements, where this issue may occur, have been transpiled away. However, looking at this issue, I found more cases that would fail with the current implementation of the `inlinePlugin`. This is part of what I added in tests but not an exhaustive list: - Shorthand object methods (`{ __DEV__() {} }`) - Labelled statements (`__DEV__: {};`) - Class methods (`class { __DEV__() {} }`) - Optional property member access (`x?.__DEV__`) All of these issues can be addressed by letting this replacement use `ReferencedIdentifier` as a visitor, rather than just `Identifier`. Pull Request resolved: #1195 Test Plan: - Tests have been added to `inline-plugin-test.js` to reflect the mentioned cases. Reviewed By: huntie Differential Revision: D52909519 Pulled By: motiz88 fbshipit-source-id: 37a6459bc917701fe8474c33ccae41cb484e92f0
@EvanBacon saw that a fix was merged into Metro directly. Does this mean this issue can be closed? 🙂 |
Fixed in |
@marklawlor I've tried running Is this something explicitly fixed by expo or resolved in metro/react-native? I'm trying to figure out which combination of package updates will hopefully resolve this. Thanks in advance for any help! |
@wollerman If you have a failure message on the latest version then you most likely have a different issue. Multiple different issues can have the same error message. Please create a new issue with a reproduction |
@marklawlor @wollerman this happens with expo51, which didn't with expo50. running
Can we reopen this issue and rename it ? |
Just hit this now after updating to 51:
|
Tracking the SDK51 regression under a new issue #28785 |
Fixed with |
Minimal reproducible example
https://github.com/mojavad/apollo-sdk50-bug-repro
Summary
When exporting with metro for web with the new SDK 50 beta, we are facing bundling issues for production builds on web as we use
@apollo/client
.The error we get is the following:
This error doesn't appear when exporting for
ios
with version SDK 50.Additionally, this error doesn't show for
expo start
, which could be due to minification with Babel?Environment
The text was updated successfully, but these errors were encountered: