SyntaxError Cannot use import statement outside a module

Hi! I've just starter using react-sigma to render a graph on my T3 app. At first everything was working as expected until suddenly the app refuses to compile anymore, giving the attached error. From googling some, I suspect the error has something to do with SSR so I'm wondering how to handle that? Break the code out into a component using a dynamic reload? Is that the way to go? Thanks in advance for any answers!
4 Replies
Ambushfall
Ambushfall2y ago
Is there any further context behind this? Is there a public repo of the code? Snippets, anything?
Vincent Udén
Vincent UdénOP2y ago
I tried my own suggestion out, moving all code for this part of the page into a separate file as a component which I then imported with no ssr like this which solved the problem. I guess I shouldve just pushed on a tiny bit futher before asking 🤷‍♂️
Vincent Udén
Vincent UdénOP2y ago
The imports at the top (from @react-sigma/core) were the ones causing trouble
Vincent Udén
Vincent UdénOP2y ago
Now it works like a charm
Want results from more Discord servers?
Add your server