projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.46k stars 1.16k forks source link

Can't build with nextJS "self is not defined" #926

Closed burak94t closed 2 years ago

burak94t commented 2 years ago

İmporting with ssr, works fine in dev mode but fails when I try to build.

Ekran Resmi 2022-04-07 13 04 40
burak94t commented 2 years ago

Fixed it, my diagram components was in pages folder and I moved them to components folder in the root directory, it's fixed the issue.

BenAllenUK commented 2 years ago

@burak94t I did this and it didnt change anything. Any other ideas?

burak94t commented 2 years ago

Can I see your code ? You should import your diagram component that includes the CanvasWidget with dynamic import (ssr:false) to your page. Also be sure there are no react-diagrams imports under your pages folder.

dincho-kostadinov commented 2 years ago

@burak94t After I import the component dynamic and add ssr:false the diagram had a huge performance issue it works very slow. Any idea?

kenneho commented 1 year ago

@burak94t After I import the component dynamic and add ssr:false the diagram had a huge performance issue it works very slow. Any idea?

I'm not getting react-diagrams to work with NextJS. Could I ask you to share some code or other helpful information?