Closed sgnilreutr closed 1 year ago
There is a hack to solve that issue:
Put that code console.log(useMediaQuery)
after your imports.
Have not used vite before - is there anything tracking this on their project since it seems like a common issue? Any guidance for library authors to avoid this?
I see the same issue with an old webpack 4 build as well, though using pnpm. I can see that the export looks correct from the index.d.ts
file though, so unclear what's going on.
it seems this issue was happending with vite 2 and fixed in vite 3 https://github.com/vitejs/vite/issues/8800
i am using vite 4 and i have the same issue, the workaround that i find out was import MediaQuery, { useMediaQuery } from 'react-responsive'; console.log(MediaQuery, useMediaQuery} it seems otherwise it thinks that useMediaQuery is part of the default export or something like that
Seems like this is a vite issue and fixed on their end, so closing this.
If you are on vite, an ESM version has been published as 10.0.0-beta.1 - please test and report any issues. May fix this issue for vite 2/3.
Thank you for this awesome library, after recently changing from CRA to Vite for a big project, the build would fail on (see screenshot). After removing the library things started to work again. Do note - that this project is fairly sized, so it can be a result of many different parts together.
Using the following: "react-responsive": "9.0.0", "react": "18.2.0" "typescript": "4.8.4", "vite": "^3.2.3",