-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Broken production with Metro bundler (ReferenceError) #736
Comments
Hey would you mind doing |
This one breaks:
This one works:
|
Yes that's extremely weird. I suppose Metro rewrite code in an odd way. |
I wonder what could be influencing this, is it miss-behaving in inlining the code it removed due to the |
Wait, I got it! You checked the wrong version (my fault, I shouldn't have posted both)
|
It works in other bundlers the problem seems to be that metro does not account for the code blocks it snips out, they must be doing this as post-processing. We'll do a PR to ensure stability on metro, hang tight. |
Maybe they just remove the conditional code block without taking care of variables defined inside. |
Can you try using the new build from the PR above that CodeSandbox CI provides please? That should fix the issue and if so we can publish the verified fix. If you're using Yarn you can just add a resolution to your "resolutions": {
"@urql/core": "https://pkg.csb.dev/FormidableLabs/urql/commit/48f86fd3/@urql/core"
}, |
@kitten It works! |
This should be released in |
Thanks, that was fast! |
Hi 👋
On the latest version, a modification (somewhere around here) broke the metro bundler in production mode (and possibly other production apps? It's not tied to minification, but I didn't tried on other bundlers).
urql version:
1.9.7
Steps to reproduce
[email protected]
, wrap your app in aProvider
with an urql clientExpected behavior
No
JS ReferenceError
.Actual behavior
For some reason, the variable is not declared.
Debugging
In order to spot the issue, I created a server to serve the unminified production bundle to my debug application. Create a file at project root:
Build a bundle with:
Then run the
server.js
file to fake metro bundler, it will be easier to debug.Fix
The missing declaration is
f
:If I add it manually to the bundle, it works:
The text was updated successfully, but these errors were encountered: