-
Notifications
You must be signed in to change notification settings - Fork 40
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
Issues with Next.js #38
Comments
I think this has to do with the Module not being shipped as CJS, or with a .MJS extension? |
Did you make any progress @wesbos ? I'm looking at this same use case |
Yes, I used an alternative lazy import package for React.I forget the name, but it was the big one... |
By this do you mean wait till the page is delivered from nextjs and then load the useEffect(() => {
setHasRendered(true)
}, [])
...
...
<div>
{hasRendered && (
<QrReader
...
/>
)}
</div> |
Apart from the above solution, this works for me <div>
{typeof window !== "undefined" && (
<>
<QRReader
onScan={onScan}
onError={onError}
></QRReader>
</>
)}
</div> |
Hello - I think this fork does SSR, right?
When I import it like so:
I get this issue:
SyntaxError: Cannot use import statement outside a module
pointing to> 1 | module.exports = require("react-qr-scanner");
I looked through the source and can't seem to find why it would think it's cjs. Any ideas?
It does work if I use next.js dynamic import, but then that that annoy as it re-imports it when it re-renders.
The text was updated successfully, but these errors were encountered: