I want to extend React-Query support on old browsers without manually testing my Next application on the said old browsers

753 Views Asked by At

I found this quote on the installation page but I don't understand the approach they want me to take:

"Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from node_modules yourselves."

You can check it here

I compared the default suppoted browers listed here vs. the release dates of those versions and would like to extend my application's support for browsers, ideally 5 and upto 10 years old.

Default React query browser support:

Chrome >= 73
Firefox >= 78
Edge >= 79
Safari >= 12.0
iOS >= 12.0
opera >= 53

I am currently using

  • TanStack Query v4
  • Next.js v13 (SWC)

So far I have tried following the SWC documentation for browser support: docs

1

There are 1 best solutions below

0
Yousria On

I was running into the same issue but with different versions :

  • TanStack Query v5
  • Next.js v14 (SWC)

you can use this config in next.config.js :

transpilePackages: ['@tanstack/query-core', ...any other package that is breaking on old browsers]

this will transpile and bundle the dependencies you provide from local packages according to Nextjs documentation

Hope it helps!