-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing exports within build #8800
Comments
I am seeing something similar too - |
Hello @Kyzegs. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
It seems you are using 2.9.12. Please try 3.0.0-beta.3 too. It includes many fixes around CJS. |
Using Vite 3.0.0-beta.4 solved the issue for me. |
Describe the bug
I'm running into an odd issue with a dependency when building with Vite.
Here's a simple component using
react-responsive
:After building with Vite (
vite build
) and visiting my website, it'll return me an error:I've tried numerous things to fix this issue. One odd fix is by simply logging the imported function.
import React from 'react'; import { useMediaQuery } from 'react-responsive'; + console.log(useMediaQuery); const Component = () => { const isMobile = useMediaQuery({ query: '(max-width: 991px)' }); if (isMobile) { return <span>Mobile view</span>; } return <span>PC View</span>; }; export default Component;
I've also run Vite in development mode (
vite
), and this issue did not arise within that environment.Reproduction
SOON
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: