-
Notifications
You must be signed in to change notification settings - Fork 199
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
Demonstrate how to replace __DEV__ with false in production builds. #51
Conversation
After installing version 3.4 in Next Js, when building and running the application, the following errors occur. How can you fix them?
|
@DennieMello Any chance you can reproduce this problem without minification? I think I recognize the It looks like As a workaround, you should be able to set |
Anticipating apollographql/apollo-client#8347 landing in Apollo Client v3.4.
17a7649
to
5c27627
Compare
I think this problem may be fixed by apollographql/apollo-client#8558 (coming soon). |
@DennieMello Alright, if this is indeed the same problem, it should be fixed in |
Thank you for such a quick response! Problem solved, everything works well |
I'm using Webpack 5 and Electron, but I still see this Here's my plugins:
But I can't get past this error: |
@tubbo Any chance you can capture that in a runnable reproduction, in a new issue? That error doesn't look quite the same as
from above, so I'd like to understand what's really happening. Thanks! |
Although a string will be handled correctly (as a code fragment), using JSON.stringify only seems to be necessary when the original value is a string: https://webpack.js.org/plugins/define-plugin/#usage I verified with `npm run build` that this change has no effect on the total bundle size of the production build. Follow-up to #51.
When using a version of
@apollo/client
with apollographql/apollo-client#8347 applied, this configuration saves a whopping 3.73kB of minified+gzip code (due to removing development-only code) when runningnpm run build
to generate an optimized production build, without requiring CRA ejection.@hwillson @brainkim If we land apollographql/apollo-client#8347 for Apollo Client v3.4, this configuration will most likely be what we recommend to Create React App folks, so I'm open to any ways we might be able to simplify it further.