-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
According to the documention, devtools should only be included in development
mode:
https://tanstack.com/query/v4/docs/devtools#install-and-import-the-devtools
React Query v3 devtools include check for that:
https://github.com/TanStack/query/blob/v3/devtools/index.js
React Query v4 are missing this check which results in devtools being bundled in production and increasing overall bundle size:
https://github.com/TanStack/query/blob/main/packages/react-query-devtools/src/index.ts
Your minimal, reproducible example
https://stackblitz.com/edit/nextjs-odbs3c?file=pages/_app.js
React Query v3 does not have this issue:
https://stackblitz.com/edit/nextjs-ssq6g3?file=pages/_app.js
Steps to reproduce
- Open
_app.js
file - Open terminal and run
npm run build
- Comment out
<ReactQueryDevtools initialIsOpen={false} />
andimport { ReactQueryDevtools } from '@tanstack/react-query-devtools';
- Run
npm run build
- Notice that shared bundle size decreased from
103kB
to90kB
Expected behavior
React Query Devtools should not be bundled in production build by default.
How often does this bug happen?
Every time
Screenshots or Videos
Next 12.2 project with devtools enabled:
Next 12.2 project with devtools disabled:
Platform
- OS: MacOS
- Browser: Chromium
- Version: 4.0.3
react-query version
4.0.3
TypeScript version
4.7.4
Additional context
No response