Skip to content
Source
Sign inSign up
TanStack/query

export 'default' was not found error when library uses @tanstack/react-query #7746

Send to my agent
ClosedAnushHakobyan(GitHub profile, opens in a new tab) opened this issue 1 comment

Describe the bug

I have a minimal example of my case. It is a react app/lib, which has an import and usage of @tanstack/react-query. However when I build with it, I receive export 'default' (imported as 'App') was not found . When I comment out the usage and the import, everything works again.

I have tried with both webpack and rollup, the same issue persist.

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-id8z1w?file=src%2Findex.js,package.json,rollup.config.js,lib%2Fbundle.js&terminal=dev

Steps to reproduce

  1. Build repo (in the example lib/bundle.js is already there)
  2. If you set this bundle in a test react application and try to import default component from the bundle you will receive an error: export 'default' (imported as 'App') was not found in './bundle' (module has no exports)

Expected behavior

It should work without this error (like it works when I remove react-query).

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • Runtime (webpack for example, when app which uses the bundle starts)

Tanstack Query adapter

None

TanStack Query version

5.51.3

TypeScript version

No response

Additional context

No response

  1. sorry, I'm not going to look into this because it's very likely an issue with your bundler configuration. I looked at the bundled output and there is nothing that strikes out as odd between the two builds

  2. TkDodo closed this

  3. TkDodo added labelswontfix

Sign in to join this conversation.