-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Defining __DEV__ in build process conflicts with warning package #8661
Comments
@sdemjanenko There should be nothing wrong with that code declaring its own local It sounds like you might be using a build-time transform that mistakenly replaces every occurrence of the
The |
@benjamn thanks for the fast response. I did a little more digging into ViteJS (the builder I am using) and it appears that there is an open issue for this vitejs/vite#4271. Just to confirm for my understanding, I need to define |
Yep, vitejs/vite#4271 looks like an accurate description of the problem! Apollo Client should still work even if you don't do anything with However, you can strip a significant amount of code (about 3kB after minification and gzip) from your JS bundle if you configure your build tool to replace any On balance, I think I would recommend not worrying about this optimization until vitejs/vite#4271 is fixed. Having an extra 3kB of bundle size for now probably isn't the end of the world (for most apps). |
Awesome. Thanks for that clarification. I'm closing this issue since the bug lies elsewhere. |
Is it required that
__DEV__
be defined in the build process in order to optimize the build or is setting process.env.NODE_ENV enough?When I tried setting
__DEV__
to be true/false, my build process ran into an error.I tracked this error down to:
https://github.com/BerkeleyTrue/warning/blob/master/warning.js#L17
It appears that the
__DEV__
name is not unique enough such that the definition only targets apollo-client.The text was updated successfully, but these errors were encountered: