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!
Introduction | React Sigma
Concept
4 Replies
Is there any further context behind this?
Is there a public repo of the code? Snippets, anything?
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 🤷♂️
The imports at the top (from @react-sigma/core) were the ones causing trouble
Now it works like a charm