-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Using only hooks from usePopper causes issues with rollup #379
Comments
I'm also having this issue it seems. However, importing Update: I think in my case this isn't a Rollup issue. When testing in Storybook (which uses webpack) I get the same issue. For me, it seems that the issue is that Popper isn't instantiating on mount unless something causes my component to re-render. So |
Ok, so I think I've found the issue. I didn't look closely enough at the docs. I was surprised to find that instead of using |
Reproduction demo
I am using usePopper hook for auto positioning a dropdown. The code works fine in a sandbox and when running in the development environment. However, it does not pass the build pipeline with rollup.
I figure out that the problem is that react-popper package has both components and hooks and when only hooks are being pulled rollup thinks that createElement used for components is being imported, but not being used. If I import Manager from react-prop into one of my modules even though the component is not being used that fixes the pipeline problem, but does not look like a right solution.
Other packages that have both hooks and components like downshift are passing the pipeline Ok.
Is it possible that hooks and components are not being separated properly?
Sandbox code
Steps to reproduce the problem
What is the expected behavior?
Expect build to pass.
What went wrong?
The build fails with an error.
Packages versions
The text was updated successfully, but these errors were encountered: