-
Notifications
You must be signed in to change notification settings - Fork 146
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
Remove react-query-devtools from production build #1121
Conversation
}, | ||
{ | ||
"path": "build/vendor.js", | ||
"maxSize": "355 kB" | ||
"maxSize": "285 kB" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📉
@@ -57,6 +58,7 @@ const AppConfig = ({children, locals = {}}) => { | |||
<MultiSiteProvider site={locals.site} locale={locals.locale} buildUrl={locals.buildUrl}> | |||
<ChakraProvider theme={theme}>{children}</ChakraProvider> | |||
</MultiSiteProvider> | |||
<ReactQueryDevtools /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the docs:
By default, React Query Devtools are only included in bundles when process.env.NODE_ENV === 'development', so you don't need to worry about excluding them during a production build.
👌
That's strange 🤔 Is the generated project really different than what's in the template-retail-react-app folder? |
Thanks @alexvuong . I made a change to CI to not run bundlesize in generated_projects. |
@kevinxh I am wondering why there is a difference between generated project and the template like that. Is it because of template is inside a monorepo? 🤔 . |
@alexvuong yea, i think so. I don't think it's super important to choose to run bundle size in either monorepo or generated project. It's a reference for us to not go over the limit, the absolute value isn't super useful. The reason why I chose to run bundlesize in the monorepo is to get the same result when developing locally when you run |
@kevinxh I think it's important that both You might want to play around with the following part of the webpack configuration:
You'll see that this rule isn't catching the imports when run in the mono-repo, maybe there is a quick fit to check for |
Updated the vendor.js chunking rule! Thanks for the suggestion! |
* v3: [Spike]Replace watch with nodemon (#1146) Fix Page Designer ImageWithText Link component (#1092) (#1148) Upgrade deprecated dependencies (#1124) Restart login flow if refresh_token is invalid (#1135) Move some util to site-utils to avoid circular imports (#1133) Restore old file name. (#1140) Update eslint configuration (#1129) CI: clarify the environment variables (#1127) Remove react-query-devtools from production build (#1121) Update lerna.json (#1118) Parallelize lighthouse ci (#1126) Increase test timeouts only on CI env (#1123) Remove unused `request` deprecated dependency. (#1125) Upgrade msw to latest (#1100) Add mergeBasket hook (#1114) [V3][Hooks Integration 🪝] Manually update cache for ShopperCustomer (#1113) dont use callback on mutateAsync (#1119) 2-spaces not 4-spaces (#1117) # Conflicts: # packages/internal-lib-build/package-lock.json # packages/pwa-kit-create-app/package-lock.json # packages/pwa-kit-dev/package-lock.json # packages/pwa-kit-dev/package.json # packages/pwa-kit-dev/src/configs/webpack/config.js # packages/pwa-kit-dev/src/ssr/server/build-dev-server.js # packages/pwa-kit-react-sdk/package-lock.json # packages/pwa-kit-runtime/package-lock.json # packages/template-express-minimal/package-lock.json # packages/template-mrt-reference-app/package-lock.json # packages/template-retail-react-app/package-lock.json # packages/template-typescript-minimal/package-lock.json # packages/test-commerce-sdk-react/package-lock.json
…-rehaul * feature/template-extensibility: [Spike]Replace watch with nodemon (#1146) Fix Page Designer ImageWithText Link component (#1092) (#1148) Upgrade deprecated dependencies (#1124) Restart login flow if refresh_token is invalid (#1135) Move some util to site-utils to avoid circular imports (#1133) Restore old file name. (#1140) Update eslint configuration (#1129) CI: clarify the environment variables (#1127) Remove react-query-devtools from production build (#1121) Update lerna.json (#1118) Parallelize lighthouse ci (#1126) Increase test timeouts only on CI env (#1123) Remove unused `request` deprecated dependency. (#1125) Upgrade msw to latest (#1100) Add mergeBasket hook (#1114) [V3][Hooks Integration 🪝] Manually update cache for ShopperCustomer (#1113) dont use callback on mutateAsync (#1119) 2-spaces not 4-spaces (#1117) # Conflicts: # packages/internal-lib-build/package-lock.json # packages/pwa-kit-dev/package-lock.json # packages/pwa-kit-react-sdk/package-lock.json # packages/pwa-kit-runtime/package-lock.json # packages/pwa-kit-runtime/package.json
Description
Goal: remove
react-query-devtools
from production build to reduce bundle size.Changes:
react-query-devtools
fromcommerce-sdk-react
react-query-devtools
in retail react appBundle analysis before & after
BEFORE
AFTER
Types of Changes
How to Test-Drive This PR
npm start
in ./packages/template-retail-react-app and open localhost:3000 and notice the devtool icon on left bottom cornerNODE_ENV=production npm start
, verify the icon is gonenpm run analyze-build
and verify thereact-query-devtools
is not in the build