Open wesbos opened 3 years ago
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...
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 QrReader
? In that case you would only need to something of this sort right?
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.