Skip to content
Source
Sign inSign up
TanStack/query

v5 beta: react-query-persist-client import coming from "react.js" #5777

Send to my agent
Closedtmm(GitHub profile, opens in a new tab) opened this issue 3 comments

Describe the bug

Build output is incorrect for @tanstack/react-query-persist-client PersistQueryClientProvider. Imports from "react.js" instead of "react"

- import * as React from "react.js";
+ import * as React from "react";

When using with Vite:

    node_modules/@tanstack/react-query-persist-client/build/modern/PersistQueryClientProvider.js:4:23:
      4 │ import * as React from "react.js";
        ╵                        ~~~~~~~~~~

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-1tmnhf?file=src%2Fmain.tsx&terminal=dev

Steps to reproduce

  1. Open minimal reproducible example
  2. Start dev server with npm run dev (should start automatically)
  3. View error in terminal

Expected behavior

Build output imports correct React location.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Firefox

Tanstack Query adapter

react-query

TanStack Query version

5.0.0-beta.0

TypeScript version

5.0.2

Additional context

No response

  1. in the sourcecode (typescript) we always do:

    import * as React from 'react'

    as you can see here:

    https://github.com/TanStack/query/blob/1d3ee672d2a1536e3463243813c91902aa97d973/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx#L2

    @lachlancollins does this have something to do with how things are bundled in beta ?

  2. in the sourcecode (typescript) we always do:

    import * as React from 'react'

    as you can see here:

    https://github.com/TanStack/query/blob/1d3ee672d2a1536e3463243813c91902aa97d973/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx#L2

    @lachlancollins does this have something to do with how things are bundled in beta ?

    Oh yeah, it probably does. I'll have a look, it might be to do with the deps/devDeps/peerDeps affecting how esbuild recognises something as external/internal.

  3. TkDodo added labelsbug

  4. TkDodo added labelsv5

  5. @TkDodo it was missing peerDeps - I'll have a fix for this soon!

  6. TkDodo closed this

Sign in to join this conversation.