PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.16k stars 351 forks source link

[BUG] Uncaught TypeError: (0 , _reactQuery.QueryClient) is not a constructor #798

Open jellohouse opened 10 months ago

jellohouse commented 10 months ago

What happened?

Trying to integrate wagmi in my extension popup like this:

...
import { WagmiConfig, createConfig, mainnet } from 'wagmi'
import { createPublicClient, http } from 'viem'

const wagmiConfig = createConfig({
  autoConnect: true,
  publicClient: createPublicClient({
    chain: mainnet,
    transport: http()
  }),
});

function App(props) {
  return (
    <WagmiConfig config={wagmiConfig}>
      <MemoryRouter>
        <PopupRouter />
      </MemoryRouter>
    </WagmiConfig>
  );
}

export default App;

But i get an error that (0 , _reactQuery.QueryClient) is not a constructor

wagmi uses @tanstack/react-query under the hood

I haven't test, but I assume just integrating react-query would give the same error.

This code worked just fine in my non-Plasmo chrome extensions before.

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

Uncaught TypeError: (0 , _reactQuery.QueryClient) is not a constructor
    at createConfig (index.js:14:21)
    at iodw8.react/jsx-dev-runtime (App.jsx:35:16)
    at newRequire (popup.7d3dc21e.js:72:24)
    at localRequire (popup.7d3dc21e.js:85:35)
    at 1LU0f.react/jsx-dev-runtime (popup.jsx:4:1)
    at newRequire (popup.7d3dc21e.js:72:24)
    at localRequire (popup.7d3dc21e.js:85:35)
    at Vd1oM.react/jsx-dev-runtime (popup.tsx:9:5)
    at newRequire (popup.7d3dc21e.js:72:24)
    at popup.7d3dc21e.js:123:5

(OPTIONAL) Contribution

Code of Conduct